Splitting the editor screen horizontally

1. After opening a file with Vim and entering normal mode by pressing the “Esc” key, proceed to execute the following command.

:split

or

:sp

2. This will split the editor screen into two sections horizontally. Alternatively you can press the keyboard combination “ctrl + w” and then press “v” to achieve the same result.

3. To Toggle between the workspaces use the following commands. To navigate to the right pane and left pane respectively use the following key bindings.

  • CTRL + W and l – Navigate to the right pane.
  • CTRL + W and h – Navigate to the left pane.

4. To move the workspace window to the far right or far left of the screen use the below mentioned key bindings.

  • CTRL+w and L – Move current window the far right and full height of the screen.
  • CTRL+W and H – Move current window the far left and use the full height of the screen.

5. Horizontal resizing can be performed after splitting the workspace horizontally by utilizing the following command.

resize <size as number>

Example

resize 20

6. Windows can be swapped [Only works if the workspace is split horizontally] using the following commands.

  • CTRL+W and r – Swap bottom/top if split horizontally
  • CTRL+W and R – Swap top/bottom if split horizontally

Splitting Vim Screen Horizontally and Vertically in Linux

Vim, short for “Vi IMproved,” is an open-source text editor which is considered to be one of the most powerful and popular text editors for Linux. Vim is a powerful and highly configurable text editor which is known for its extensive feature set. It is available for free download and use across various platforms, including MacOS, Linux, and Windows. In this article we will see how to split the vim editor screen horizontally and vertically.

Similar Reads

Installing Vim

Utilize the following commands to install Vim on different Linux distributions....

Splitting the editor screen horizontally

1. After opening a file with Vim and entering normal mode by pressing the “Esc” key, proceed to execute the following command....

Splitting the editor screen Vertically.

1. After opening a file with Vim and entering normal mode by pressing the “Esc” key, proceed to execute the following command....

Changing the width and height of the Workspace

The height and width of each individual splits can be increased or decreased as per our requirements. Let is consider the following workspace as an example and try to modify the height and width of the splits....

Conclusion

In this article, we illustrated how to create horizontal or vertical splits within an active Vim workspace, and also gained insights on resizing split windows, closing active splits, and efficiently navigating between open windows....

Contact Us