diff --git a/autoload/vimteractive.vim b/autoload/vimteractive.vim index 6fcaaac..632d4ba 100644 --- a/autoload/vimteractive.vim +++ b/autoload/vimteractive.vim @@ -141,10 +141,12 @@ function! vimteractive#term_start(term_type) " Turn line numbering off set nonumber norelativenumber - " Switch to terminal-normal mode when entering buffer - autocmd BufEnter call feedkeys("\N") - " Switch to insert mode when leaving buffer - autocmd BufLeave execute "silent! normal! i" + if g:vimteractive_switch_mode + " Switch to terminal-normal mode when entering buffer + autocmd BufEnter call feedkeys("\N") + " Switch to insert mode when leaving buffer + autocmd BufLeave execute "silent! normal! i" + endif " Make :quit really do the right thing cabbrev q bdelete! " cabbrev qu bdelete! " diff --git a/doc/vimteractive.txt b/doc/vimteractive.txt index f156af0..beac8aa 100644 --- a/doc/vimteractive.txt +++ b/doc/vimteractive.txt @@ -153,6 +153,7 @@ These options can be put in your |.vimrc|, or run manually as desired: let g:vimteractive_vertical = 1 " Vertically split terminals let g:vimteractive_autostart = 0 " Don't start terminals by default + let g:vimteractive_switch_mode = 0 " Don't switch to normal mode ============================================================================== diff --git a/plugin/vimteractive.vim b/plugin/vimteractive.vim index 8ba6598..6c636a6 100644 --- a/plugin/vimteractive.vim +++ b/plugin/vimteractive.vim @@ -19,6 +19,11 @@ if !has_key(g:, 'vimteractive_vertical') let g:vimteractive_vertical = 0 endif +" Switch to normal mode when entering the buffer by default +if !has_key(g:, 'vimteractive_switch_mode') + let g:vimteractive_switch_mode = 1 +endif + " Variables for running the various sessions if !has_key(g:, 'vimteractive_commands') let g:vimteractive_commands = { }