Home

Vim splits

Vim allows you to work on multiple files or different parts of the same file simultaneously by splitting the screen. This feature greatly enhances productivity when working on complex projects.

To split the screen, use the following commands

:sp - split horizontally and open the same file in split screen
:vs - split vertically and open the same file in split screen

To open a new file in a split, use:

:sp [filename] - split horizontally and open [filename] 
:vs [filename] - split vertically and open [filename]

Moving between splits

CTRL-W followed by h, j, k, or l moves between splits.

To resize splits, use the CTRL-W window command.

      CTRL-W +  - increase height of current split
      CTRL-W -  - decrease height of current split
      CTRL-W >  - increase width of current split
      CTRL-W <  - decrease width of current split
      CTRL-W =  - make all splits equal size
Tags: Vim, Neovim