Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Cesar Enrique Ramirez committed Apr 17, 2020
0 parents commit 8aa477b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
28 changes: 28 additions & 0 deletions autoload/nvim-maximize-window-toggle.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
""
" @public
" If the current tab page has more than one window,
" opens the current buffer alone in a new tab.
" Calling this function again in the new window will
" close the tab and go back to the original window
""
function! nvim-maximize-window-toggle#ToggleOnly()
if winnr("$") > 1
" There are more than one window in this tab
if exists("b:maximized_window_id")
call win_gotoid(b:maximized_window_id)
else
let b:origin_window_id = win_getid()
tab sp
let b:maximized_window_id = win_getid()
endif
else
" This is the only window in this tab
if exists("b:origin_window_id")
let l:origin_window_id = b:origin_window_id
tabclose
call win_gotoid(l:origin_window_id)
unlet b:maximized_window_id
unlet b:origin_window_id
endif
endif
endfunction
15 changes: 15 additions & 0 deletions doc/nvim-maximize-window-toggle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*nvim-maximize-window-toggle.txt*
*nvim-maximize-window-toggle*

==============================================================================
CONTENTS *nvim-maximize-window-toggle-contents*
1. Commands...........................|nvim-maximize-window-toggle-commands|

==============================================================================
COMMANDS *nvim-maximize-window-toggle-commands*

:ToggleOnly *:ToggleOnly*
Maximize the current buffer as a toggle


vim:tw=78:ts=8:ft=help:norl:
4 changes: 4 additions & 0 deletions plugin/nvim-maximize-window-toggle.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
""
" Maximize the current buffer as a toggle
""
command! ToggleOnly call nvim-maximize-window-toggle#ToggleOnly()

0 comments on commit 8aa477b

Please sign in to comment.