Add unbound "toggle" action for customization

This commit is contained in:
Junegunn Choi 2015-05-21 01:35:35 +09:00
parent 34946b72a5
commit 801cf9ac62
3 changed files with 11 additions and 2 deletions

View File

@ -181,12 +181,13 @@ e.g. \fBfzf --bind=ctrl-j:accept,ctrl-k:kill-line\fR
end-of-line end-of-line
forward-char forward-char
forward-word forward-word
kill-line kill-line (not bound)
kill-word kill-word
page-down page-down
page-up page-up
toggle (not bound)
toggle-down toggle-down
toggle-sort toggle-sort (not bound; equivalent to \fB--toggle-sort\fR)
toggle-up toggle-up
unix-line-discard unix-line-discard
unix-word-rubout unix-word-rubout

View File

@ -344,6 +344,8 @@ func parseKeymap(keymap map[int]actionType, toggleSort bool, str string) (map[in
keymap[key] = actToggleDown keymap[key] = actToggleDown
case "toggle-up": case "toggle-up":
keymap[key] = actToggleUp keymap[key] = actToggleUp
case "toggle":
keymap[key] = actToggle
case "down": case "down":
keymap[key] = actDown keymap[key] = actDown
case "up": case "up":

View File

@ -105,6 +105,7 @@ const (
actUnixWordRubout actUnixWordRubout
actYank actYank
actBackwardKillWord actBackwardKillWord
actToggle
actToggleDown actToggleDown
actToggleUp actToggleUp
actDown actDown
@ -724,6 +725,11 @@ func (t *Terminal) Loop() {
t.input = append(t.input[:t.cx-1], t.input[t.cx:]...) t.input = append(t.input[:t.cx-1], t.input[t.cx:]...)
t.cx-- t.cx--
} }
case actToggle:
if t.multi && t.merger.Length() > 0 {
toggle()
req(reqList)
}
case actToggleDown: case actToggleDown:
if t.multi && t.merger.Length() > 0 { if t.multi && t.merger.Length() > 0 {
toggle() toggle()