mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 11:29:01 +00:00
Add offset-up and offset-down
# Scrolling will behave similarly to CTRL-E and CTRL-Y of vim fzf --bind scroll-up:offset-up,scroll-down:offset-down \ --bind ctrl-y:offset-up,ctrl-e:offset-down \ --scroll-off=5 Close #3456
This commit is contained in:
parent
4feaf31225
commit
404b6a864b
@ -55,7 +55,15 @@ CHANGELOG
|
|||||||
--bind 'preview-scroll-down:preview-down+preview-down' \
|
--bind 'preview-scroll-down:preview-down+preview-down' \
|
||||||
--preview 'cat {}'
|
--preview 'cat {}'
|
||||||
```
|
```
|
||||||
|
- Added `offset-up` and `offset-down` actions
|
||||||
|
```sh
|
||||||
|
# Scrolling will behave similarly to CTRL-E and CTRL-Y of vim
|
||||||
|
fzf --bind scroll-up:offset-up,scroll-down:offset-down \
|
||||||
|
--bind ctrl-y:offset-up,ctrl-e:offset-down \
|
||||||
|
--scroll-off=5
|
||||||
|
```
|
||||||
- Shell extensions
|
- Shell extensions
|
||||||
|
- Updated bash completion for fzf options
|
||||||
- bash key bindings no longer requires perl; it will use awk or mawk
|
- bash key bindings no longer requires perl; it will use awk or mawk
|
||||||
instead if perl is not found
|
instead if perl is not found
|
||||||
- Basic context-aware completion for ssh command
|
- Basic context-aware completion for ssh command
|
||||||
|
@ -1157,6 +1157,8 @@ A key or an event can be bound to one or more of the following actions.
|
|||||||
\fBhalf-page-down\fR
|
\fBhalf-page-down\fR
|
||||||
\fBhalf-page-up\fR
|
\fBhalf-page-up\fR
|
||||||
\fBhide-preview\fR
|
\fBhide-preview\fR
|
||||||
|
\fBoffset-down\fR (similar to CTRL-E of Vim)
|
||||||
|
\fBoffset-up\fR (similar to CTRL-Y of Vim)
|
||||||
\fBpos(...)\fR (move cursor to the numeric position; negative number to count from the end)
|
\fBpos(...)\fR (move cursor to the numeric position; negative number to count from the end)
|
||||||
\fBprev-history\fR (\fIctrl-p\fR on \fB--history\fR)
|
\fBprev-history\fR (\fIctrl-p\fR on \fB--history\fR)
|
||||||
\fBprev-selected\fR (move to the previous selected item)
|
\fBprev-selected\fR (move to the previous selected item)
|
||||||
|
@ -1179,6 +1179,10 @@ func parseActionList(masked string, original string, prevActions []*action, putA
|
|||||||
appendAction(actTogglePreviewWrap)
|
appendAction(actTogglePreviewWrap)
|
||||||
case "toggle-sort":
|
case "toggle-sort":
|
||||||
appendAction(actToggleSort)
|
appendAction(actToggleSort)
|
||||||
|
case "offset-up":
|
||||||
|
appendAction(actOffsetUp)
|
||||||
|
case "offset-down":
|
||||||
|
appendAction(actOffsetDown)
|
||||||
case "preview-top":
|
case "preview-top":
|
||||||
appendAction(actPreviewTop)
|
appendAction(actPreviewTop)
|
||||||
case "preview-bottom":
|
case "preview-bottom":
|
||||||
|
@ -378,6 +378,8 @@ const (
|
|||||||
actPosition
|
actPosition
|
||||||
actHalfPageUp
|
actHalfPageUp
|
||||||
actHalfPageDown
|
actHalfPageDown
|
||||||
|
actOffsetUp
|
||||||
|
actOffsetDown
|
||||||
actJump
|
actJump
|
||||||
actJumpAccept
|
actJumpAccept
|
||||||
actPrintQuery
|
actPrintQuery
|
||||||
@ -3404,6 +3406,19 @@ func (t *Terminal) Loop() {
|
|||||||
case actHalfPageDown:
|
case actHalfPageDown:
|
||||||
t.vmove(-(t.maxItems() / 2), false)
|
t.vmove(-(t.maxItems() / 2), false)
|
||||||
req(reqList)
|
req(reqList)
|
||||||
|
case actOffsetUp, actOffsetDown:
|
||||||
|
diff := 1
|
||||||
|
if a.t == actOffsetDown {
|
||||||
|
diff = -1
|
||||||
|
}
|
||||||
|
t.offset += diff
|
||||||
|
before := t.offset
|
||||||
|
t.constrain()
|
||||||
|
if before != t.offset {
|
||||||
|
t.offset = before
|
||||||
|
t.vmove(diff, false)
|
||||||
|
}
|
||||||
|
req(reqList)
|
||||||
case actJump:
|
case actJump:
|
||||||
t.jumping = jumpEnabled
|
t.jumping = jumpEnabled
|
||||||
req(reqJump)
|
req(reqJump)
|
||||||
|
Loading…
Reference in New Issue
Block a user