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

Basic usage of vim

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

Share

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

1. Movement of the cursor

H move to the left

J move down

K move up

L (lowercase L) move to the right

Shift+6 (number 0) moves to the beginning of the line

Shift+4 moves to the end of the line

Gg moves to the first line

The end of the line of G movement

NG moves to the line where the number n is located

Ctrl+B turn the page forward

Ctrl+F turns the page backward

two。 Delete and paste

X delete one character backward X delete one character forward

Nx deletes n characters backward nX deletes n characters forward

Dd deletes a row

Ndd delete digits n lines

Yy replication

P cursor down copy P cursor up copy

U restore the operation of the previous step

V selected string

3. Edit mode

I insert before the current character

I insert at the beginning of the current line

An insert after the current character

An insert at the end of the current line

O insert a line under the line where the cursor is located

O insert a row on the line where the cursor is located

4. Command mode

/ word look for a string behind the cursor and press n to continue the search

? Word looks for a string before the cursor and presses n to continue the search

: N1 word1 n2sqqqqword1max Word2max g look for word1 between N1 and N2 lines and replace it with word2 without adding g, then only the first word1 of each line is replaced.

: 1 word2 word2 in the document without g, only the first word1 of each line will be replaced

W save text

: Q exit vim

: w! Forced save, which can be completed even if the text is read-only under root users

: q! Forced exit, all changes will not take effect

Wq saves and exits

: set nu displays the line number

: set nonu does not display line numbers

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