From 801cf9ac6241dc4a01a5f4ba87fcc9746c15a20e Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 21 May 2015 01:35:35 +0900 Subject: [PATCH] Add unbound "toggle" action for customization --- man/man1/fzf.1 | 5 +++-- src/options.go | 2 ++ src/terminal.go | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/man/man1/fzf.1 b/man/man1/fzf.1 index a696cb7..86f07de 100644 --- a/man/man1/fzf.1 +++ b/man/man1/fzf.1 @@ -181,12 +181,13 @@ e.g. \fBfzf --bind=ctrl-j:accept,ctrl-k:kill-line\fR end-of-line forward-char forward-word - kill-line + kill-line (not bound) kill-word page-down page-up + toggle (not bound) toggle-down - toggle-sort + toggle-sort (not bound; equivalent to \fB--toggle-sort\fR) toggle-up unix-line-discard unix-word-rubout diff --git a/src/options.go b/src/options.go index abae6f3..d0014a7 100644 --- a/src/options.go +++ b/src/options.go @@ -344,6 +344,8 @@ func parseKeymap(keymap map[int]actionType, toggleSort bool, str string) (map[in keymap[key] = actToggleDown case "toggle-up": keymap[key] = actToggleUp + case "toggle": + keymap[key] = actToggle case "down": keymap[key] = actDown case "up": diff --git a/src/terminal.go b/src/terminal.go index 1a78fed..9099576 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -105,6 +105,7 @@ const ( actUnixWordRubout actYank actBackwardKillWord + actToggle actToggleDown actToggleUp actDown @@ -724,6 +725,11 @@ func (t *Terminal) Loop() { t.input = append(t.input[:t.cx-1], t.input[t.cx:]...) t.cx-- } + case actToggle: + if t.multi && t.merger.Length() > 0 { + toggle() + req(reqList) + } case actToggleDown: if t.multi && t.merger.Length() > 0 { toggle()