Skip to content

Commit

Permalink
Add :VenterToggle
Browse files Browse the repository at this point in the history
  • Loading branch information
JMcKiern committed Jun 20, 2020
1 parent aaeb43c commit 469f1df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Run `git clone https://github.com/jmckiern/vim-venter ~/.vim/bundle/vim-venter`

`:VenterClose` - Close venter

`:VenterToggle` - Toggle venter

`:VenterResize` - Force a window resize (usually only happens on VimResized, TabEnter and WinEnter events)

### Options
Expand Down
8 changes: 8 additions & 0 deletions autoload/venter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ function! venter#Venter()
call s:DisableStatuslines()
endfunction

function! venter#VenterToggle()
if exists("t:venter_tabid") && has_key(s:open_winids, t:venter_tabid)
call VenterClose()
else
call venter#Venter()
endif
endfunction

function! VenterClose()
if exists("t:venter_tabid") && has_key(s:open_winids, t:venter_tabid)
execute 'let l:winids = deepcopy(s:open_winids.'.t:venter_tabid.')'
Expand Down
4 changes: 4 additions & 0 deletions plugin/venter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ if !exists(":Venter")
command -nargs=0 Venter :call venter#Venter()
endif

if !exists(":VenterToggle")
command -nargs=0 VenterToggle :call venter#VenterToggle()
endif

let &cpo = s:save_cpo
unlet s:save_cpo

0 comments on commit 469f1df

Please sign in to comment.