From 9bcef048c728ac2dc2878770d44df031098f822e Mon Sep 17 00:00:00 2001 From: crater2150 Date: Mon, 8 Jul 2019 16:11:06 +0200 Subject: [PATCH] Change fzf integration to more customizable version --- zplug.zsh | 22 ++++++++++++++++++++++ zshrc | 1 - 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/zplug.zsh b/zplug.zsh index 93ac04f..af83bb9 100644 --- a/zplug.zsh +++ b/zplug.zsh @@ -1,6 +1,7 @@ source $(zdotfile zplug/init.zsh) zplug "MichaelAquilina/zsh-you-should-use" +zplug 'crater2150-zsh/fzf-widgets' zplug 'molovo/revolver', \ as:command, \ @@ -12,3 +13,24 @@ zplug 'zunit-zsh/zunit', \ zplug load + +if zplug check 'crater2150-zsh/fzf-widgets'; then + # Map widgets to key + bindkey '\ec' fzf-change-directory + bindkey '^r' fzf-insert-history + bindkey '^xf' fzf-insert-files + bindkey '^xd' fzf-insert-directory + bindkey '^xn' fzf-insert-named-directory + + # Start fzf in a tmux pane + FZF_WIDGET_TMUX=1 + + # use fd for finding directories and files + FZF_CHANGE_DIR_COMMAND="fd -t d" + FZF_INSERT_DIR_COMMAND="fd -t d" + FZF_INSERT_FILES_COMMAND="fd -t f" + FZF_EDIT_FILES_COMMAND="fd -t f" + + # modify history command to remove duplicates + FZF_HISTORY_COMMAND="fc -l 1 | sed 's/ *[0-9]* //g' | awk '!seen[\$0]++'" +fi diff --git a/zshrc b/zshrc index 071875d..d8b00e9 100644 --- a/zshrc +++ b/zshrc @@ -51,6 +51,5 @@ echo $PATH | grep -q 'sbin' || . /etc/zsh/zprofile FZF_ALT_C_COMMAND="fd -t d" -[[ -e /usr/share/doc/fzf/key-bindings.zsh ]] && . /usr/share/doc/fzf/key-bindings.zsh exists todo && todo