← Back to Upcase

Vim switch one window to full-screen

(Jon Seidel) #1

I use vim/tmux daily and love the combination, in spite of the occasional quirks (Thanks, Thoughtbot for getting me going with tmux!).

I have multiple tmux windows, one for each sub-project, and each window has 1-3 panes. My top/largest pane is vim, and I have multiple vim windows arranged, usually showing the specific files for that sub-project that I normally work on; the currently-active file buffer automatically resizes when I move into it. All that works great as I have created a number of vim & tmux & shell shortcuts to assist.

One use case I have is that occasionally even my resized windows aren’t big enough and I want to switch that one vim window to full-screen. I finally found a quick, easy way to do that; here it is in case anyone is looking for this [or maybe it’s just obvious and it took me a while to catch up :-].

When in the window you want to resize, just type:

  :tabnew %

and that buffer is automatically opened as a new full-size tab. When you’re done with your edits, just type:


and the tab is closed and you’re back in your original window in that same window with all the updates.

I’ve remapped the zoom command to: ,,z with my <Leader> so that’s is easy to get to. Maybe this will help someone else.

(Esop) #2

That is handy. Thanks!

(Jon Kinney) #3

Nice hack! There’s also a vim plugin called zoom-win that I use to do this. It’s a little different in that the fact that you’re zoomed isn’t maybe as obvious as with your scenario, but that might be more desirable too, depending on your preference.

(Drew Neil) #4

You can also do <C-w>T (that is, control-w followed by shift-T), which has the same effect as :tabnew %.

(Jon Seidel) #5

Thanks, @nelstrom. Only issue I have with this is that it removes that window from my initial layout. Once you close the new window, you’ll have to reopen that file again.