Reputation: 3638
I've enabled the following mappings in my init.vim
:
tnoremap <Esc> <C-\><C-n>
tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-l> <C-\><C-n><C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
These greatly improve windows navigation in Vim.
However, I've noticed that C-h
does not work as expected when executed in terminal buffer. Trying this on a usual terminal session results in Backspace
action. So probably it seems to be one of these alternative key combinations, like C-i
for Tab
or C-[
for Esc
. But is there any way to make C-h
work in Neovim's terminal session as per my bindings?
Thanks!
Upvotes: 1
Views: 1154
Reputation: 3638
This issue has already been extensively debated here. Original Vim does not rely on terminfo
and includes its own patch for correct handling of C-h
sequences. Neovim does look at terminfo
though.
Briefly, the fix is executing these commands in the shell:
infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
tic $TERM.ti
Upvotes: 3