Thursday, May 31, 2018

Vim Window Sizing


There are few Window commands in Vim I really find useful but sometimes hard to remember regarding changing the size:
  • Maximize current horizontal window: Ctrl-w _
  • Maximize current vertical window: Ctrl-w |
  • Change the height of the current window:
    • Ctrl-w +
    • Ctrl-w - 
    • :resize 5
      • Replace 5 with the desired positive or negative number.
  • Change the width of the current window:
    • Ctrl-w >
    • Ctrl-w <
    • :vertical resize -5 
      • Replace -5 with the desired positive or negative number.
  • Close other windows: :only
    • The buffers remain open.
  • Convert the current window to a tab: Ctrl-w T
    • With this command you lose the original window.
  • Open current buffer in a tab: :tabe %
    • This is a good option to temporarily maximize (or zoom) the current window and then quit the tab to go back to all windows in the state you left them. It does not close the original window like Ctrl-w T.