junegunn / fzf.vim

fzf :heart: vim
MIT License
9.51k stars 581 forks source link

override fzf_history_dir option CTRL-P and CTRL-N mappings #1522

Closed zigius closed 3 months ago

zigius commented 4 months ago

Hey,

I saw in https://github.com/junegunn/fzf/blob/master/README-VIM.md#configuration that you can set fzf_history_dir to enable history navigation. However, setting the fzf_history_dir global flag overrides the CTRL-P and CTRL-N mappings to search through the history navigation. Is there a way to change the history mapping keys to something else? I would like to have history navigation and also keep the behavior where CTRL-P and CTRL-N navigate the results.

Thanks :)

junegunn commented 3 months ago

The remapping can be prevented by explicitly mapping ctrl-n and ctrl-p to down and up in your FZF_DEFAULT_OPTS.

So something like this should work.

export FZF_DEFAULT_OPTS='--bind ctrl-n:down,ctrl-p:up,alt-n:next-history,alt-p:prev-history'

Or if you prefer to put it in your Vim configuration file.

let $FZF_DEFAULT_OPTS = '--bind ctrl-n:down,ctrl-p:up,alt-n:next-history,alt-p:prev-history'