From 677da6b5bd7fba7c70d51bc4a7893c3c3466afbd Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Thu, 9 Jan 2020 22:30:32 +0200 Subject: [PATCH] Move fzf functions to functions file Signed-off-by: Marko Korhonen --- home/.config/zsh/01-env.zsh | 6 ------ home/.config/zsh/03-functions.zsh | 9 ++++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/home/.config/zsh/01-env.zsh b/home/.config/zsh/01-env.zsh index 14f81b8..915cf06 100644 --- a/home/.config/zsh/01-env.zsh +++ b/home/.config/zsh/01-env.zsh @@ -18,12 +18,6 @@ export FZF_DEFAULT_COMMAND='rg --files --hidden 2>/dev/null' export FZF_COMPLETION_TRIGGER='**' export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_ALT_C_COMMAND='rg --hidden --files --null --sort path 2>/dev/null | xargs -0 dirname | uniq' -_fzf_compgen_dir() { - rg --hidden --files --null --sort path 2>/dev/null | xargs -0 dirname | uniq -} -_fzf_compgen_path() { - rg --files --hidden 2>/dev/null -} # use lesspipe with less export LESSOPEN="|lesspipe.sh %s" diff --git a/home/.config/zsh/03-functions.zsh b/home/.config/zsh/03-functions.zsh index 7d1fe07..5bd4e39 100644 --- a/home/.config/zsh/03-functions.zsh +++ b/home/.config/zsh/03-functions.zsh @@ -16,13 +16,20 @@ gpush() { git push $@ } # Syntax highlighting cat cat() { nvimpager -c $@ } - rip() { abcde printf "Ripping done. Importing to library" beet import ~/Documents/Rip/flac/* } +# make fzf zsh plugin use ripgrep +_fzf_compgen_dir() { + rg --hidden --files --null --sort path "$1" 2>/dev/null | xargs -0 dirname | uniq +} +_fzf_compgen_path() { + rg --files --hidden "$1" 2>/dev/null +} + # search and install packages with fzf yi() { SELECTED_PKGS="$(yay -Slq | fzf --header='Install packages' -m --preview 'yay -Si {1}')"