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

Vim document editing

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

Share

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

Vim has a variety of working modes, including normal mode, insert mode and command mode.

Normal mode: cursor movement and shortcut key operation can be realized.

Insert mode: basic editing function of text

Command mode: enter specific instructions to achieve specific functions such as save, exit

One: cursor operation

H. Move one bit to the left

J. Move one bit down

K. Move one bit up

L. Move one bit to the right

Gg. First line of file

G. End of file

NG. Move the number of rows n (number of rows)

^. The first character of the current line

$. The trailing character of the current line

Two: insert mode

A. Insert behind the current cursor

A. Insert at the end of the current paragraph

I. Insert in front of the current cursor

I. Insert into the beginning of the current paragraph

O. Create a new blank line after the current line

O. Create a new blank line before the current line

Three: edit the document

X. Delete the current character of the cursor

Dd. Delete a row

Ndd. Delete n lines

D $. Delete the cursor to the end of the line

U. Undo the previous step, enter it twice, which means undo two steps

Yy. Copying the current line 5yy represents five lines after the copy cursor

P. Paste after the current line

P. Paste before the current line

Four: save and exit

: q!. Do not save and exit

: wq. Save and exit

: x. Save and exit

: w. Save

: w a.txt. Save as a.txt

Vim Tips

Display line number: set number abbreviation: set nu ignores case lookup words apple / apple\ c case-insensitive substitution: s/root/admin/ replaces the first root that appears on the current line with admin

All root in the current line of s/root/admin/g is replaced with admin

3 s/root/admin/ 5 replace all root of lines 3 to 5 with admin

:% s/root/admin/g replace root for all lines with admin

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