Skip to main content
Commonmark migration
Source Link

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

~/.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?

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?

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?

deleted 1 character in body
Source Link
Brad Parks
  • 175
  • 1
  • 14

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

###~/.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?

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?

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?

Notice removed Draw attention by Brad Parks
Bounty Ended with Matt's answer chosen by Brad Parks
Notice added Draw attention by Brad Parks
Bounty Started worth 50 reputation by Brad Parks
slight rewording for disambiguation, formatting
Source Link

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 enters the pane inswitches 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

~/.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?

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 enters the pane in 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?

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?

added 269 characters in body
Source Link
Brad Parks
  • 175
  • 1
  • 14
Loading
Source Link
Brad Parks
  • 175
  • 1
  • 14
Loading