From ca692d30d0c3771f1b84d764eaeda702b115ae41 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 8 Oct 2020 11:09:13 +0200 Subject: [PATCH] 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. --- sh/.config/sh/env | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sh/.config/sh/env b/sh/.config/sh/env index b2fd712..d6ff82d 100644 --- a/sh/.config/sh/env +++ b/sh/.config/sh/env @@ -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