To increase a window to its maximum width, use Ctrl-w | . In Gvim and vim in terminals with mouse support, it is also possible to use the mouse to resize a window. Simply grab the statusline at the window border and drag it into the desired direction.
Control + W followed by W to toggle between open windows and, Control + W followed by H / J / K / L to move to the left/bottom/top/right window accordingly, Control + W followed by Left / Down / Up / Right arrow to move to the left/bottom/top/right window accordingly.
Press Control + w , then hit q to close each window at a time.
Ctrl+W_ will maximize a window vertically.
Ctrl+W| will maximize a window horizontally.
So far as I'm aware, there is no way to restore the previous layout after these actions, but Ctrl+W= will resize all windows to equal sizes.
An option could be to pursue the editing in a new tab. The following command opens the active buffer into a new tab allowing you to see the buffer in the hole vim window.
:tab split
And close the tab when you're done:
:tabc
Edit:
You can always use the following command to use tt
as a shortcut (or better add it to your .vimrc
):
:noremap tt :tab split<CR>
and close is when you're done :
:wq
If I understand what you're asking, I think you'll find the ZoomWin plugin helpful (GitHub). If you've got a bunch of split windows, and you want to temporarily make the current window the only visible one, you can hit <C-w>o
. When you want to revert to the previous split state, hit <C-w>o
again.
[Edit] Note on key mappings:
The default key mapping for this plugin is <C-w>o
, but that conflicts with a default Vim key mapping. By default, that does :only
, which makes the current window the only window. If you'd like to retain that functionality, you can remap ZoomWin to another key. I remap it to <C-w>w
, because I like to use the :only
option as well. Here's my mapping:
nnoremap <silent> <C-w>w :ZoomWin<CR>
Note that this also overrides a default Vim mapping, related to moving to other visible windows (:help CTRL-W_w
), but I never used that one anyway.
ctrl-w_ - maximize current window
hope this helps you out. :)
And these are the some of the useful commands with can be implemented using VIM editor
:e filename - edit another file
:split filename - split window and load another file
ctrl-w up arrow - move cursor up a window
ctrl-w ctrl-w - move cursor to another window (cycle)
ctrl-w= - make all equal size
10 ctrl-w+ - increase window size by 10 lines
:vsplit file - vertical split
:sview file - same as split, but readonly
:hide - close current window
:only - keep only this window open
:ls - show current buffers
:b 2 - open buffer #2 in this window
An awesome plugin for toggling windows fullscreen is vim-maximizer.
After it's installed you can simply use <F3>
(default shortcut) to toggle fullscreen on the window.
You can also customize the shortcut keys, for example if you wanted to use <C-w> z
(similar to tmux shortcut):
nnoremap <silent><C-w>z :MaximizerToggle<CR>
vnoremap <silent><C-w>z :MaximizerToggle<CR>gv
inoremap <silent><C-w>z <C-o>:MaximizerToggle<CR>
I've tried ZoomWin and a few others. The problem is, they all destroy and try to re-create the windows. This is especially problematic with custom plugins like NERDTree, Tagbar and a few others. Icons and fonts are not drawn properly, sizes are messed up etc..
zoomwintab.vim is a simple zoom window plugin that uses vim's tabs feature to zoom into a window inspired by ZoomWin plugin but in a non-destructive manner.
https://github.com/troydm/zoomwintab.vim
I use Tmux, so I mapped it to <leader> z
to stay in sync with tmux's <prefix> z
nnoremap <leader>z :ZoomWinTabToggle<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With