Skip to main content
1 of 3
aharris88
  • 1.9k
  • 2
  • 17
  • 22

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