From 690a65629d175653f9e616a0e9338b6649758abf Mon Sep 17 00:00:00 2001 From: "Rieger, Simon" Date: Mon, 28 Aug 2023 11:56:52 +0200 Subject: [PATCH] add fzf support for linux and darwin --- .../fzf-bash_darwin.tmpl | 0 .chezmoitemplates/fzf-bash_linux.tmpl | 13 +++++++++++++ .../fzf-zsh_darwin.tmpl | 0 .chezmoitemplates/fzf-zsh_linux.tmpl | 13 +++++++++++++ dot_fzf.bash.tmpl | 5 +++++ dot_fzf.zsh.tmpl | 5 +++++ 6 files changed, 36 insertions(+) rename dot_fzf.bash => .chezmoitemplates/fzf-bash_darwin.tmpl (100%) create mode 100644 .chezmoitemplates/fzf-bash_linux.tmpl rename dot_fzf.zsh => .chezmoitemplates/fzf-zsh_darwin.tmpl (100%) create mode 100644 .chezmoitemplates/fzf-zsh_linux.tmpl create mode 100644 dot_fzf.bash.tmpl create mode 100644 dot_fzf.zsh.tmpl diff --git a/dot_fzf.bash b/.chezmoitemplates/fzf-bash_darwin.tmpl similarity index 100% rename from dot_fzf.bash rename to .chezmoitemplates/fzf-bash_darwin.tmpl diff --git a/.chezmoitemplates/fzf-bash_linux.tmpl b/.chezmoitemplates/fzf-bash_linux.tmpl new file mode 100644 index 0000000..8641a05 --- /dev/null +++ b/.chezmoitemplates/fzf-bash_linux.tmpl @@ -0,0 +1,13 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == */home/{{ .chezmoi.username }}/.fzf/bin* ]]; then + PATH="${PATH:+${PATH}:}/home/{{ .chezmoi.username }}/.fzf/bin" +fi + +# Auto-completion +# --------------- +[[ $- == *i* ]] && source "/home/{{ .chezmoi.username }}/.fzf/shell/completion.bash" 2> /dev/null + +# Key bindings +# ------------ +source "/home/{{ .chezmoi.username }}/.fzf/shell/key-bindings.bash" diff --git a/dot_fzf.zsh b/.chezmoitemplates/fzf-zsh_darwin.tmpl similarity index 100% rename from dot_fzf.zsh rename to .chezmoitemplates/fzf-zsh_darwin.tmpl diff --git a/.chezmoitemplates/fzf-zsh_linux.tmpl b/.chezmoitemplates/fzf-zsh_linux.tmpl new file mode 100644 index 0000000..d8a0331 --- /dev/null +++ b/.chezmoitemplates/fzf-zsh_linux.tmpl @@ -0,0 +1,13 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == */home/{{ .chezmoi.username }}/.fzf/bin* ]]; then + PATH="${PATH:+${PATH}:}/home/{{ .chezmoi.username }}/.fzf/bin" +fi + +# Auto-completion +# --------------- +[[ $- == *i* ]] && source "/home/{{ .chezmoi.username }}/.fzf/shell/completion.bash" 2> /dev/null + +# Key bindings +# ------------ +source "/home/{{ .chezmoi.username }}/.fzf/shell/key-bindings.zsh" diff --git a/dot_fzf.bash.tmpl b/dot_fzf.bash.tmpl new file mode 100644 index 0000000..d262c24 --- /dev/null +++ b/dot_fzf.bash.tmpl @@ -0,0 +1,5 @@ +{{- if eq .chezmoi.os "darwin" -}} +{{- template "fzf-bash_darwin.tmpl" . -}} +{{- else if eq .chezmoi.os "linux" -}} +{{- template "fzf-bash_linux.tmpl" . -}} +{{- end -}} diff --git a/dot_fzf.zsh.tmpl b/dot_fzf.zsh.tmpl new file mode 100644 index 0000000..db3666d --- /dev/null +++ b/dot_fzf.zsh.tmpl @@ -0,0 +1,5 @@ +{{- if eq .chezmoi.os "darwin" -}} +{{- template "fzf-zsh_darwin.tmpl" . -}} +{{- else if eq .chezmoi.os "linux" -}} +{{- template "fzf-zsh_linux.tmpl" . -}} +{{- end -}}