I'm trying to remap Control + [hjkl] to navigate among splits, by setting this in my rc file:
" splits navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
However, <C-h>
isn't working; it moves the cursor left a character, as if I had hit backspace (i.e. it traverses lines, unlike my h
). The other movements work.
Asking (neo)vim for mapping information about <C-h>
doesn't show anything suspicious looking:
:verbose map <C-h>
n <C-H> <C-W>h
Last set from ~/workspace/dotfiles/.nvimrc
However, if I ask about <C-j>
(which works as expected), it says that <NL>
is involved?
:verbose map <C-j>
n <NL> <C-W>j
Last set from ~/workspace/dotfiles/.nvimrc
Changing the order of my nnoremap
s doesn't seem to change the behavior.
How should I debug this?
<C-h>
. If you try it in a terminal, you will see a similar behaviour. Also see:h backspace
.:h backspace
notes that "<NL>" is related to "CTRL-J".noremap <C-h> <c-w><c-h>
(i.e. <c-h> instead of h) as they are equivalent<C-h>
remap with your suggestion causes an audible bell, and no cursor movement. (Pressing<C-w><C-h>
does work jump to the split to the left.)