Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the split screen Operation of Vim by linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces linux how to achieve Vim split screen operation, the article introduces in great detail, has a certain reference value, interested friends must read it!

The split screen function of Vim is realized by dividing windows, which is a sharp tool to improve work efficiency. Whether we want to display two files at the same time, or two different locations of the same file at the same time, or compare two files side by side, etc., these can be achieved through split screens, which is very convenient for code comparison, copy and paste.

Split the screen horizontally to open a new file

: sp linuxmi.py or: split linuxmi.py

This command cuts the window horizontally into two windows and places the cursor in the upper window.

Split the screen vertically to open a new file

: vsp linux.py: vsplit linux.py

: sview linux.py-> read-only split screen opening file

In addition, to open a window to edit a new file, you can use the following command:

: new

Open multiple files directly from the command line and split the screen

Vim-On file1, file2...-> Vertical split vim-on file1, file2.-> horizontal split linuxmi@linuxmi:~/www.linuxmi.com$ vim-O3 linux.py linuxmi.py linuxmi.cpp

Note:-O vertical split screen,-o horizontal split screen, n means several screens

Adjust the width of the current window in real time

Ctrl-w > / / widen to the right. The default value is 1 ctrl-w N > / / broadening width to the right N ctrl-w < / /

Horizontal / vertical screen split to open the current file

Ctrl+w s ctrl+w v

Toggle split screen

Ctrl+w hjjjjjjjjjjjjjjjjjjjjjl ctrl+w the next key about crtl+w to switch the split window, press a w crtl+w to switch the split window, press a r interchange window crtl+w to switch the split window, press a c to close the window after pressing

Turn off split screen

There are several commands to close the window:

Ctrl+W c closes the current window ctrl+w Q closes the current window, if there is only one split and exits vim: only retains only the current split: hide closes the current split

Resize the split screen (width and height)

Ctrl+w = uniform height for all split screens ctrl+w + increase height, default is 1 ctrl+w-decrease height 10 ctrl+w + increase 10 lines height ctrl-w N + / / current screen height plus N

Use to specify the adjustment height of the current screen

: res [ize] N

Example:

: resize 30

Mobile split screen

Ctrl+W H,J,K,L

Move the screen to the top

Ctrl-w + K

Move the screen to the lowest end

Ctrl-w + J

Move the screen to the far left

Ctrl-w + H

Move the screen to the far right

Ctrl-w + L above is all the content of this article "how to achieve Vim split screen operation by linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report