fzf
fzf copied to clipboard
mapping synonym for ctrl-m to not be enter
- [x] I have read through the manual page (
man fzf
) - [x] I have the latest version of fzf
- [x] I have searched through the existing issues
Info
- OS
- [x] Linux
- [ ] Mac OS X
- [ ] Windows
- [ ] Etc.
- Shell
- [x] bash
- [ ] zsh
- [ ] fish
Problem / Steps to reproduce
I am using my own key mappings for moving around. My problem is that I would like to move up in the list of files with ctrl-i and move down with ctrl-m.
I did achieve this with:
FZF_DEFAULT_OPTS='--bind ctrl-m:down,ctrl-i:up'
But now I cant hit enter to accept, since ctrl-m is a synonym of enter. Is there a way to change the synonym mappings? So that I can use ctrl-m to navigate down and still use enter to accept my selected item?
I have tried
FZF_DEFAULT_OPTS='--bind ctrl-m:down,ctrl-i:up,enter:accept'
which did not work.
I am really new to fzf but did read through the man page and the issues and did not find an issue about this. Seems to be an easy fix since no one mentioned this problem before.
greetings
ctrl-m is the same keybinding as enter when received by terminals, there is no way to bind one of them without binding the other.
Ctrl-m and Enter key presses on Windows both generate CtrlM
event, but the Enter event has 0
modifier state, unlike the Ctrl-m, that has ModCtrl
bit set (as expected). So it would be possible to distinguish the key events (we don't currently). I am not sure how useful this info is in the context of *nix terminals, but if this issue gets accepted, might be worth it to take closer look.
ctrl-m is the same keybinding as enter when received by terminals, there is no way to bind one of them without binding the other
My understanding is that it's the terminal that maps Ctrl-m and ENTER to the same character. See this StackExchange post for how to circumvent this. Unfortunately, for that fix to work with fzf, you would still need #2478 to be implemented. So I would suggest closing the present issue in favor of #2478.