diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2022-12-27 01:01:06 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2022-12-27 01:08:42 +0900 |
commit | 12af069dcad672b1563388c61ec33ba8a86c013e (patch) | |
tree | 887acd14cfe3ee74b6e181129765e27d9660fcb6 /src/options.go | |
parent | d42e708d3140aab099b30014a9cbebafb8b66692 (diff) |
Add pos(...) action to move the cursor to the numeric position
# Put the cursor on the 10th item
seq 100 | fzf --sync --bind 'start:pos(10)'
# Put the cursor on the 10th to last item
seq 100 | fzf --sync --bind 'start:pos(-10)'
Close #3069
Close #395
Diffstat (limited to 'src/options.go')
-rw-r--r-- | src/options.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/options.go b/src/options.go index 1fb649f2..91ac9881 100644 --- a/src/options.go +++ b/src/options.go @@ -890,7 +890,7 @@ const ( func init() { executeRegexp = regexp.MustCompile( - `(?si)[:+](execute(?:-multi|-silent)?|reload|preview|change-query|change-prompt|change-preview-window|change-preview|(?:re|un)bind)`) + `(?si)[:+](execute(?:-multi|-silent)?|reload|preview|change-query|change-prompt|change-preview-window|change-preview|(?:re|un)bind|pos)`) splitRegexp = regexp.MustCompile("[,:]+") actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+") } @@ -1197,6 +1197,8 @@ func isExecuteAction(str string) actionType { return actChangePrompt case "change-query": return actChangeQuery + case "pos": + return actPosition case "execute": return actExecute case "execute-silent": |