From 08a42fc019eb1bb85a3df4f90ec99102cc590b8e Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 30 Aug 2021 22:21:39 +0100 Subject: [PATCH] feat(completion): switch from peco to fzf for command history completion And also setup and configure fzf zsh plugins: - ctrl+r searches shell history. - ctrl+t searches for files and folders by name recursively within current directory while previewing highlighted item via less. - alt+c recursively lists directories within current directory, and changes to the selected directory. --- zsh/fzf.zsh | 18 ++++++++++++++++++ zshrc | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 zsh/fzf.zsh diff --git a/zsh/fzf.zsh b/zsh/fzf.zsh new file mode 100644 index 0000000..95a6dc9 --- /dev/null +++ b/zsh/fzf.zsh @@ -0,0 +1,18 @@ +# +# fzf +# + +export FZF_DEFAULT_OPTS="--bind=ctrl-k:kill-line --border=none --tabstop=4" +export FZF_TMUX_HEIGHT=100% +export FZF_TMUX=0 +export FZF_CTRL_T_OPTS="--preview='less {}'" + +# Install fzf binary from latest GitHub Release. +zinit ice from'gh-r' as'program' pick'fzf' +zinit light junegunn/fzf + +# Install fzf-tmux command and zsh plugins from default branch on GitHub. +zinit ice from'gh' as'program' pick'bin/fzf-tmux' \ + multisrc'shell/{completion,key-bindings}.zsh' \ + id-as'junegunn/fzf-extras' +zinit light junegunn/fzf diff --git a/zshrc b/zshrc index 337ebde..8dbd0d4 100644 --- a/zshrc +++ b/zshrc @@ -59,8 +59,6 @@ zinit snippet OMZ::plugins/bundler zinit ice pick'plain.zsh-theme' zinit light jimeh/plain.zsh-theme -zinit ice wait lucid -zinit light jimeh/zsh-peco-history zinit ice wait lucid atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" zinit light zdharma/fast-syntax-highlighting @@ -113,6 +111,7 @@ if [[ "$OSTYPE" == "linux"* ]]; then source "$DOTZSH/linux.zsh"; fi # Utils source "$DOTZSH/emacs.zsh" +source "$DOTZSH/fzf.zsh" source "$DOTZSH/git.zsh" source "$DOTZSH/less.zsh" source "$DOTZSH/rclone.zsh"