I'm trying to use NeoVim as a tmux replacement, and have found that no matter what I do, I can't get it to go into insert mode when I click in a pane that has a terminal in it.
Here's the config I'm trying to use, with no luck. Currently the config lets me navigate between panes, and when I enter the pane using the keyboard it switches to insert mode.
But when I enter the pane by clicking the mouse, it goes back to normal mode, which I almost never want.
~/.config/nvim/init.vim
set mouse=a
if has('nvim')
autocmd TermOpen term://* startinsert
autocmd TermEnter term://* startinsert
autocmd BufEnter term://* startinsert
endif
" Edit files within Nvim's terminal without nesting sessions.
augroup prevent_nested_edit
autocmd VimEnter * if !empty($NVIM_LISTEN_ADDRESS) && $NVIM_LISTEN_ADDRESS !=# v:servername
\ |let g:r=jobstart(['nc', '-U', $NVIM_LISTEN_ADDRESS],{'rpc':v:true})
\ |let g:f=fnameescape(expand('%:p'))
\ |noau bwipe
\ |call rpcrequest(g:r, "nvim_command", "edit ".g:f)
\ |call rpcrequest(g:r, "nvim_command", "call lib#SetNumberDisplay(1)")
\ |qa
\ |endif
augroup END
NOTE: I have found very similar questions, but they don't seem to work for when I "click" in the terminal - they work for navigating into the terminal pane with the keyboard:
How to enter insert mode when entering neovim terminal pane?
nnoremap <LeftMouse> <LeftMouse>i
?