October 12, 2015

iTerm2 C-h key fixed for VIM and NeoVim

Why this broken?

Most VIM folks remap for quicker window pane navigation. So instead of hitting Ctrl-wh to move the cursor to left window pane the Ctrl-h key is remapped to do the same thing.

Ctrl-H is “ASCII backspace” but terminals ought to be sending ASCII DEL for the Backspace key instead.  Which means to go to the left pane I had to type C-w-h. Found the above solution in this lengthy thread for NeoVIM Issue #2048 and it should work for VIM users as well.

iTerm2 C-h key fixed for VIM and NeoVim

This has been driving me nuts this week since I’m back on OS/X from Linux.   Decided to hunt down a fix tonight and found a very simple solution.

For future reference, this is how to configure iTerm2 to send the correct CSI for ctrl+h

Edit -> Preferences -> Keys

Press +

Press Ctrl+h as Keyboard Shortcut

Choose Send Escape Sequence as Action

Type [104;5u for Esc+

Enjoy.