diff --git a/man/man1/fzf.1 b/man/man1/fzf.1 index 5d4cad7c..b4d5f8aa 100644 --- a/man/man1/fzf.1 +++ b/man/man1/fzf.1 @@ -482,7 +482,7 @@ Use black background .BI "--history=" "HISTORY_FILE" Load search history from the specified file and update the file on completion. When enabled, \fBCTRL-N\fR and \fBCTRL-P\fR are automatically remapped to -\fBnext-history\fR and \fBprevious-history\fR. +\fBnext-history\fR and \fBprev-history\fR. .TP .BI "--history-size=" "N" Maximum number of entries in the history file (default: 1000). The file is @@ -978,6 +978,7 @@ A key or an event can be bound to one or more of the following actions. \fBpage-up\fR \fIpgup\fR \fBhalf-page-down\fR \fBhalf-page-up\fR + \fBprev-history\fR (\fIctrl-p\fR on \fB--history\fR) \fBpreview(...)\fR (see below for the details) \fBpreview-down\fR \fIshift-down\fR \fBpreview-up\fR \fIshift-up\fR @@ -987,7 +988,6 @@ A key or an event can be bound to one or more of the following actions. \fBpreview-half-page-up\fR \fBpreview-bottom\fR \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 diff --git a/src/options.go b/src/options.go index b3724663..eceeffa2 100644 --- a/src/options.go +++ b/src/options.go @@ -1060,8 +1060,8 @@ func parseKeymap(keymap map[tui.Event][]*action, str string) { appendAction(actHalfPageUp) case "half-page-down": appendAction(actHalfPageDown) - case "previous-history": - appendAction(actPreviousHistory) + case "prev-history", "previous-history": + appendAction(actPrevHistory) case "next-history": appendAction(actNextHistory) case "toggle-preview": @@ -1805,7 +1805,7 @@ func postProcessOptions(opts *Options) { // Default actions for CTRL-N / CTRL-P when --history is set if opts.History != nil { if _, prs := opts.Keymap[tui.CtrlP.AsEvent()]; !prs { - opts.Keymap[tui.CtrlP.AsEvent()] = toActions(actPreviousHistory) + opts.Keymap[tui.CtrlP.AsEvent()] = toActions(actPrevHistory) } if _, prs := opts.Keymap[tui.CtrlN.AsEvent()]; !prs { opts.Keymap[tui.CtrlN.AsEvent()] = toActions(actNextHistory) diff --git a/src/options_test.go b/src/options_test.go index e9cb5922..0fb569fe 100644 --- a/src/options_test.go +++ b/src/options_test.go @@ -354,10 +354,10 @@ func TestDefaultCtrlNP(t *testing.T) { f.Close() hist := "--history=" + f.Name() check([]string{hist}, tui.CtrlN, actNextHistory) - check([]string{hist}, tui.CtrlP, actPreviousHistory) + check([]string{hist}, tui.CtrlP, actPrevHistory) check([]string{hist, "--bind=ctrl-n:accept"}, tui.CtrlN, actAccept) - check([]string{hist, "--bind=ctrl-n:accept"}, tui.CtrlP, actPreviousHistory) + check([]string{hist, "--bind=ctrl-n:accept"}, tui.CtrlP, actPrevHistory) check([]string{hist, "--bind=ctrl-p:accept"}, tui.CtrlN, actNextHistory) check([]string{hist, "--bind=ctrl-p:accept"}, tui.CtrlP, actAccept) diff --git a/src/terminal.go b/src/terminal.go index 2b4d25e4..a5d54694 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -315,7 +315,7 @@ const ( actPreviewPageDown actPreviewHalfPageUp actPreviewHalfPageDown - actPreviousHistory + actPrevHistory actNextHistory actExecute actExecuteSilent @@ -2859,7 +2859,7 @@ func (t *Terminal) Loop() { prefix := copySlice(t.input[:t.cx]) t.input = append(append(prefix, event.Char), t.input[t.cx:]...) t.cx++ - case actPreviousHistory: + case actPrevHistory: if t.history != nil { t.history.override(string(t.input)) t.input = trimQuery(t.history.previous())