I recently used Atom and really liked the split feature (cmd+k then left/right arrow key). It makes it easy to work on large files. This is especially useful when working on Drupal modules. Instead of splitting code into different include files, we can keep functions in .module file and easily edit different lines of the file simultaneously. However, both Atom and vscode take a few seconds to start-up. Most times you don’t want to wait for an editor to start up. So here’s how Vim does split:

There are at least two ways to split: window and tab. Window is better if you want to see the files side-by-side.

Window:

  • To split current buffer vertically: :vsplit
  • To open a different buffer in a vertically split window: :split filename
  • To close the current window: :hide
  • Show open buffers: :ls
  • To open buffer #9 in current window: :b 9
  • To put new buffer on the right: :set splitright

Tab:

  • To open current buffer in a new tab page: :tab split
  • To switch to next tab: gt
  • To switch to prev tab: gT

Resources