Maximize the current split

4.7
(41)

If you’re like me, you split your Vim screen many different ways in order to keep numerous files open and visible at the same time. We’ve written a lot of splits before including:

That last one, <ctrl-w> o is useful for getting a bigger view of a single one of your splits. I use this often. But a frustrating aspect of it is that there’s no easy way to go back to the intricate split setup I had prior.

Well, there is a plugin for that actually and it’s now become an integral part of my workflow. The vim-maximizer plugin adds a command you can use to toggle the current split to fill the entire screen. The other splits are pushed out of the way. When the command is run again, the splits return to their original positions. This makes it ideal for getting a better look at the current file but then returning your screen to have the full context with all your splits.

After installing the plugin, I added the following mapping to my .vimrc, which allows me to use <ctrl-w> m (for “maximize”) to toggle back and forth:

" maximize current split or return to previous
noremap <C-w>m :MaximizerToggle<CR>

Take a look at this mapping in action. See how easy it is to go back and forth between all my splits open and just the one I’m interested in.

How useful was this tip?

Average rating 4.7 / 5. Vote count: 41

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

105 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts