How can I temporarily make the window I'm working on to be fullscreen in vim?

vim

Solution

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.

Problem

I use vim, and usually have more than one vertical/horizental window open, usually editing c++ header files alongside cpp files. How can I temporarily make the window I'm working on to be fullscreen, edit what I want, and then exit fullscreen? By fullscreen I mean to fit vim window only, and not my total display screen.

Original source