sh: Add default fzf options and binds

tab and shift-tab will select up and down,
ctrl-g moves to the first entry,
ctrl-t toggles the preview window on and off,
ctrl-d/ctrl-u scroll through the preview window.

By default, a preview window of the contents of whatever file is
currently selected will be displayed.

I would rather have the preview hidden by default, but it is hidden in
the default options it becomes hard to show it automatically again for
individual commands, so this seems a better compromise.
This commit is contained in:
Marty Oehme 2020-10-08 11:09:13 +02:00
parent cd52e47e22
commit ca692d30d0
Signed by: Marty
GPG Key ID: B7538B8F50A1C800
1 changed files with 4 additions and 0 deletions

View File

@ -46,3 +46,7 @@ export SHELL=${SHELL:-/bin/bash}
if [ "$(find /usr/share/terminfo -name "$TERMINAL*" | wc -l)" -eq 0 ] || [ -z "$TERMINAL" ]; then
export TERM=xterm
fi
if exist fzf; then
export FZF_DEFAULT_OPTS="--bind 'tab:toggle+down,shift-tab:toggle+up,ctrl-g:top,ctrl-t:toggle-preview,ctrl-d:preview-half-page-down,ctrl-u:preview-half-page-up' --color=light -1 -m --delimiter : --preview 'nl {1}' --preview-window +{2}-5"
fi