Vim seams to be simple and without many features. But it’s just false first impression. One of “hidden” feature is splitted window.

By default new viewport shows file visible in current viewport.

Splitting:

  • :sp, :split — splits window horizontaly
  • :sp filename, :split filename — splits window horizontaly and opens filename
  • :12 sp, :12 split — splits window horizontaly with heigth = 12 lines
  • :vsp, :vsplit — splits verticaly
  • :vsp filename, :vsplit filename — splits verticaly and opens filename
  • :12 vsp, :12 vsplit — splits verticaly with width = 12 chars

Working with splitted view:

  • Ctrl-w Ctrl-w — moves between Vim viewports.
  • Ctrl-w j — moves focus one viewport down.
  • Ctrl-w k — moves focus one viewport up.
  • Ctrl-w h — moves focus one viewport to the left.
  • Ctrl-w l — moves focus one viewport to the right.
  • Ctrl-w = — tells Vim to resize viewports to be of equal size.
  • Ctrl-w – — shorten current viewport by one line.
  • Ctrl-w + — enlarge current viewport by one line.
  • Ctrl-w > — widen current viewport by one char.
  • Ctrl-w < — decrease width of current viewport by one char.
  • Ctrl-w q — will close the active viewport.
  • Ctrl-w r — will rotate all viewports to the right / down.
  • Ctrl-w R — will rotate all viewports to the left / up.

https://www.linux.com/training-tutorials/vim-tips-using-viewports/ https://benaiah41.wordpress.com/2009/02/21/resizing-vertical-viewports-in-vim/
⤧  Next post Sudo with env variables ⤧  Previous post Convince Eclipse to use other JavaVM than default