m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-14 22:33:47 -05:00

Add change-prompt action

Close #2270
This commit is contained in:
Junegunn Choi
2020-12-04 20:34:41 +09:00
parent d2af3ff98d
commit 6d647e13ff
6 changed files with 65 additions and 28 deletions

View File

@@ -735,7 +735,7 @@ func init() {
// Backreferences are not supported.
// "~!@#$%^&*;/|".each_char.map { |c| Regexp.escape(c) }.map { |c| "#{c}[^#{c}]*#{c}" }.join('|')
executeRegexp = regexp.MustCompile(
`(?si)[:+](execute(?:-multi|-silent)?|reload|preview):.+|[:+](execute(?:-multi|-silent)?|reload|preview)(\([^)]*\)|\[[^\]]*\]|~[^~]*~|![^!]*!|@[^@]*@|\#[^\#]*\#|\$[^\$]*\$|%[^%]*%|\^[^\^]*\^|&[^&]*&|\*[^\*]*\*|;[^;]*;|/[^/]*/|\|[^\|]*\|)`)
`(?si)[:+](execute(?:-multi|-silent)?|reload|preview|change-prompt):.+|[:+](execute(?:-multi|-silent)?|reload|preview|change-prompt)(\([^)]*\)|\[[^\]]*\]|~[^~]*~|![^!]*!|@[^@]*@|\#[^\#]*\#|\$[^\$]*\$|%[^%]*%|\^[^\^]*\^|&[^&]*&|\*[^\*]*\*|;[^;]*;|/[^/]*/|\|[^\|]*\|)`)
}
func parseKeymap(keymap map[int][]action, str string) {
@@ -749,6 +749,8 @@ func parseKeymap(keymap map[int][]action, str string) {
prefix = symbol + "reload"
} else if strings.HasPrefix(src[1:], "preview") {
prefix = symbol + "preview"
} else if strings.HasPrefix(src[1:], "change-prompt") {
prefix = symbol + "change-prompt"
} else if src[len(prefix)] == '-' {
c := src[len(prefix)+1]
if c == 's' || c == 'S' {
@@ -922,6 +924,8 @@ func parseKeymap(keymap map[int][]action, str string) {
offset = len("reload")
case actPreview:
offset = len("preview")
case actChangePrompt:
offset = len("change-prompt")
case actExecuteSilent:
offset = len("execute-silent")
case actExecuteMulti:
@@ -961,6 +965,8 @@ func isExecuteAction(str string) actionType {
return actReload
case "preview":
return actPreview
case "change-prompt":
return actChangePrompt
case "execute":
return actExecute
case "execute-silent":