0

To make things a bit quicker, I've remapped the window switching commands like this:

nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-h> <C-w>h
nnoremap <silent> <C-l> <C-w>l

My goal is to type <C-j>, <C-k>, etc., to switch between window splits. The <C-j> and <C-k bindings work, but for some reason <C-h> and <C-l> don't do anything. <C-w>h and <C-w>l work as expected.

If I run :nmap, I see the following for those commands:

...
n  <C-H>       * <C-W>h
n  <NL>        * <C-W>j
n  <C-K>       * <C-W>k
n  <C-L>       * <C-W>l
...

I'm using Neovim 0.1.4

Edit

I mispoke earlier. It looks like <C-l> is working as well. That just leaves <C-h> not working.

3
  • It's most likely because those shortcuts are being intercepted by your terminal, rather than a problem with vim. What terminal are you using?
    – DJMcMayhem
    May 18, 2016 at 22:47
  • Ah, that's totally possible. I'm using iTerm2 2.9.20160206 along with tmux 2.1. I'm not sure how to fix that though. May 18, 2016 at 23:52
  • 1
    Have a look at vi.stackexchange.com/questions/7722/how-do-i-debug-my-mapping
    – nobe4
    May 19, 2016 at 9:11

1 Answer 1

2

After digging into this some more, it looks like this is a known issue with Neovim and tmux. iTerm2 is interpreting <C-h> as a backspace and sending that instead. As a workaround, I've mapped backspace to to the action I want:

if has('nvim')
  nnoremap <bs> <C-w>h
endif

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.