mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-30 03:43:50 -07:00
Add toggle-in and toggle-out for --bind
Related: #452 When `--multi` is set, tab key will bring your cursor down, and shift-tab up. But since fzf by default draws the screen in bottom-up fashion, one may feel that the opposite of the behavior is more desirable and choose to customize the key bindings as follows. export FZF_DEFAULT_OPTS="--bind tab:toggle-up,shift-tab:toggle-down" This configuration, however, becomes no longer straightforward when `--reverse` is set and fzf switches to top-down layout. To address the requirement, this commit adds `toggle-in` and `toggle-out` option which switch direction depending on `--reverse`-ness. export FZF_DEFAULT_OPTS="--bind tab:toggle-out,shift-tab:toggle-in"
This commit is contained in:
@@ -125,6 +125,8 @@ const (
|
||||
actToggleAll
|
||||
actToggleDown
|
||||
actToggleUp
|
||||
actToggleIn
|
||||
actToggleOut
|
||||
actDown
|
||||
actUp
|
||||
actPageUp
|
||||
@@ -949,6 +951,16 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
req(reqList, reqInfo)
|
||||
}
|
||||
case actToggleIn:
|
||||
if t.reverse {
|
||||
return doAction(actToggleUp, mapkey)
|
||||
}
|
||||
return doAction(actToggleDown, mapkey)
|
||||
case actToggleOut:
|
||||
if t.reverse {
|
||||
return doAction(actToggleDown, mapkey)
|
||||
}
|
||||
return doAction(actToggleUp, mapkey)
|
||||
case actToggleDown:
|
||||
if t.multi && t.merger.Length() > 0 {
|
||||
toggle()
|
||||
|
Reference in New Issue
Block a user