Skip to content

Commit

Permalink
Add option to change mode switching behaviour (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ettom authored Mar 10, 2020
1 parent b31abee commit 319609a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions autoload/vimteractive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 <buffer> call feedkeys("\<C-W>N")
" Switch to insert mode when leaving buffer
autocmd BufLeave <buffer> execute "silent! normal! i"
if g:vimteractive_switch_mode
" Switch to terminal-normal mode when entering buffer
autocmd BufEnter <buffer> call feedkeys("\<C-W>N")
" Switch to insert mode when leaving buffer
autocmd BufLeave <buffer> execute "silent! normal! i"
endif
" Make :quit really do the right thing
cabbrev <buffer> q bdelete! "
cabbrev <buffer> qu bdelete! "
Expand Down
1 change: 1 addition & 0 deletions doc/vimteractive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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


==============================================================================
Expand Down
5 changes: 5 additions & 0 deletions plugin/vimteractive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 = { }
Expand Down

0 comments on commit 319609a

Please sign in to comment.