Skip to content

Commit

Permalink
Add 'put' action for putting the character to the prompt
Browse files Browse the repository at this point in the history
fzf --bind 'space:preview(date)+put'

Close junegunn#2456
  • Loading branch information
junegunn committed Nov 3, 2021
1 parent f799b56 commit 673c5d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions man/man1/fzf.1
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ A key or an event can be bound to one or more of the following actions.
\fBpreview-top\fR
\fBprevious-history\fR (\fIctrl-p\fR on \fB--history\fR)
\fBprint-query\fR (print query and exit)
\fBput\fR (put the character to the prompt)
\fBrefresh-preview\fR
\fBreload(...)\fR (see below for the details)
\fBreplace-query\fR (replace query string with the current selection)
Expand Down
6 changes: 6 additions & 0 deletions src/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,12 @@ func parseKeymap(keymap map[tui.Event][]action, str string) {
appendAction(actEnableSearch)
case "disable-search":
appendAction(actDisableSearch)
case "put":
if key.Type == tui.Rune && unicode.IsGraphic(key.Char) {
appendAction(actRune)
} else {
errorExit("unable to put non-printable character: " + pair[0])
}
default:
t := isExecuteAction(specLower)
if t == actIgnore {
Expand Down

0 comments on commit 673c5d8

Please sign in to comment.