diff options
| -rw-r--r-- | zsh/zshfzf | 14 | ||||
| -rw-r--r-- | zsh/zshrc | 2 |
2 files changed, 11 insertions, 5 deletions
@@ -1,10 +1,16 @@ source <(fzf --zsh) fzf_widget() { - BUFFER=$(fd | fzf --multi --scheme=path\ - --preview 'preview {} $FZF_PREVIEW_LINES' --preview-label='File Preview') - CURSOR=$#BUFFER - zle redisplay + local selected + selected=$(fd | fzf --multi --scheme=path\ + --preview 'preview {} $FZF_PREVIEW_LINES' --preview-label='File Preview' |\ + sed 's/^\(.*\)$/"\1"/' | tr '\n' ' ') + + if [[ -n $selected ]]; then + BUFFER="$BUFFER$selected" + CURSOR=$#BUFFER + fi + zle redisplay } zle -N fzf_widget @@ -26,7 +26,7 @@ bindkey -v # Plugins source ~/.config/zsh/zshvimodes -eval "$(fzf --zsh)" +source ~/.config/zsh/zshfzf # Prompt setopt PROMPT_SUBST |
