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

Multi-window usage of Vim in Linux system

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains the "multi-window use of Vim under the Linux system". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the multi-window use of Vim under the Linux system".

Using the vsp command:

For example, there are files under a certain folder:

The code is as follows:

Vector.cc, substr.cc

1. Use the vim command to open any file: vim vector.cc opens the first file. As shown in the following figure:

two。 Press: "Esc" key + ":" and enter

The code is as follows:

: vsp substr.cc

. (here the vsp operation is the same as the vi/vim operation, and the path can be switched freely.) As shown in the following figure:

3. Press the Enter key. As shown in the following figure:

4. In order to allow the mouse to switch freely between several screens.

Press: "Esc" key + ":", enter:

The code is as follows:

Set mouse=a

. Then, Enter so that the mouse can move freely between multiple screens. As shown in the following figure:

General operation of vim multi-window:

1. Open multiple windows

The commands to open multiple windows are as follows:

Horizontal cutting window

: new+ window name (file name after saving)

: split+ window name, can also be abbreviated to: sp+ window name

Vertical cut window name

: vsplit+ window name, can also be abbreviated to: vsp+ window name

2. Close multiple windows

You can use: Q windows, or you can use: close. The last window cannot be closed with close. Using close only temporarily closes the window, and its contents are still in the cache, only using Q!, w! Or x to really quit.

Tabc closes the current window

Tabo closes all windows

3. Window switching

: ctrl+w+j/k, you can switch up and down through JUnik, or: ctrl+w plus the next key, and you can switch windows in turn by quickly double-clicking ctrl+w.

4. Window resizing

Vertical adjustment

: ctrl+w + expand vertically (the number of rows increases)

: ctrl+w-Vertical reduction (number of rows reduced)

: res (ize) num for example:: res 5, the number of display lines is adjusted to 5 lines

: res (ize) + num increases the height of the current window by num lines

: res (ize)-num reduces the height of the current window by num lines

Lateral adjustment

: vertical res (ize) num specifies that the current window is a num column

: vertical res (ize) + num adds a num column to the current window

: vertical res (ize)-num reduces the current window to num columns

5. Rename the window

: f file

6. Vi opens multiple files

Vi a b c

: n jump to the next file, or you can directly specify the file to be skipped, such as: n / c, you can skip to the c file directly

: e# go back to the file you just edited

7. File browsing

: Ex opens the directory browser, you can browse all the files in the current directory, and you can choose

Sex splits the current window horizontally and opens the directory browser in one window

Ls displays the current buffer situation

8. Switch between vi and shell

Shell can switch to the shell command line without shutting down vi

Exit returns to vi from shell

Thank you for your reading, the above is the content of "the multi-window use of Vim under the Linux system". After the study of this article, I believe you have a deeper understanding of the multi-window use of Vim under the Linux system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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