3

Similar to the question about ctrlp, I would like to know how to change the key remapping to move the cursor on fzf library.

Right now, only the ctrl + k works to move the cursor upward, but all the downside movement does not work.

So how can I define the key remapping?

3 Answers 3

6

this is the default mapping of up and down in fzf:

  • down : ctrl-j ctrl-n down
  • up : ctrl-k ctrl-p up

Most people don't have problem with this. If you really really want to add your own setting, you need to change enviroment variable:

export FZF_DEFAULT_OPTS='--bind=ctrl-w:up,ctrl-m:down'

above setting will bind ctrl-w to up, ctrl-m to down. check man fzf for detail.

1

You can use --bind to change mappings to everything you like:

So something along the lines of this should work for you:

map <silent> <F2> :call fzf#run({'source': 'rg --files --column --no-heading --hidden --follow --glob "!.git/*"', 'sink': 'e', 'down': '~30%', 'options': '--bind ctrl-o:up,ctrl-l:down'})<cr>

Of course only the options part is important for your question, but I wanted to keep the context.

For every keymap option available check man fzf

0
-1

I use Ctrlp as its likely to be much more stable and bugfree and pretty comparable to fzf (with ctrlp-py-matcher), and probably lot more options for customization: https://github.com/weiliu89/dotfiles/blob/master/.vim/doc/ctrlp.txt

fzf.vim also seems to have default bindings: https://github.com/junegunn/fzf.vim/issues/56

Hopefully, fzf will be integrated to ctrlp someday soon..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.