I am using zsh, urxvt, tmux and in there vim. I am not 100% sure who causes the effect but I would like to bind something to ctrl and m but not to carriage return in vim. Does somebody how this is done?
Thank you very much in advance!
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityI am using zsh, urxvt, tmux and in there vim. I am not 100% sure who causes the effect but I would like to bind something to ctrl and m but not to carriage return in vim. Does somebody how this is done?
Thank you very much in advance!
As far as Vim is concerned, <C-M>
and <CR>
are the same thing: they are represented in the same way internally.
If your terminal is truly sending different keycodes (mine doesn't) for when you press Ctrl-M vs Enter, then you might be able to map them separately by using their literal values when you set up the mappings.
Replace the following in your vimrc
/Vimscript:
nnoremap <CR> [keypresses]
nnoremap <C-M> [other keypresses]
With the following,
nnoremap [actual ctrl-m keycode] [keypresses]
nnoremap [actual CR keycode] [other keypresses]
Where you enter the keycodes by pressing Ctrl-VCtrl-M and Ctrl-VEnter, respectively.