Skip to main content
3 of 3
edited body; edited title
Vivian De Smedt
  • 21.2k
  • 5
  • 22
  • 40

How to enter insert mode when entering Neovim terminal pane?

I have the following mappings to make it easy to move out of a terminal pane in Neovim:

tnoremap <C-h> <C-\><C-n><C-w>h
" Workaround since <C-h> isn't working in Neovim right now
tnoremap <C-w>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

The only problem is that when I move back into the terminal pane, I have to press i to get back into insert mode. I always want it to be in insert mode when I move into a Neovim pane that is running terminal. What's the best way to achieve this?

aharris88
  • 1.9k
  • 2
  • 17
  • 22