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 editing mode

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

Share

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

Vim mode

1. Command mode

two。 Insert mode

3. Exit mode

Want to check the host's version signal hostnamectl

Configure vim working mode under the command

: set nu

: set nonu

: set mouse=a

: set cursorline

The above operations only take effect in the currently open vim (you can see if there are any changes by the process number). If you set permanent validity to edit the file / etc/vimrc for configuration (not available under vimrc) + vim for more configuration

Search for characters

/ keyword

N-up matching

N downward matching

: noh unhighlights

Character management

Y

Copy one letter, copy three letters, copy a word yly3lyw.

D

Delete one letter, delete three letters, delete one word, delete one line, delete three lines of dld3ldwddd3d

C

Cut one letter, cut three letters, cut one word, cut one line, cut three lines, cut three words clc3lcwccc3cc3w

Note: vim will enter insert mode after cutting. If you want to paste, press [esc] to exit insert mode and press P to paste.

P paste

U undo

Ctrl + r resume revocation

Vim visualization mode

Ctrl + v can choose region operation in this mode.

Add characters in batch

Ctrl + v Select the column where you want to add characters

Press uppercase I.

Add characters

Press [esc]

Character substitution

:% s / characters to be replaced / characters to be replaced / g

:% sUniPUBERGUBUBG

: 1, 5, 5, 2, 5, 5, 5, 5, 2, 5, 5, 5, 5, 2, 5, 5, 5, 2, 5, 5, 5, 2, 5, 5, 5, 2, 5, 5, 5, 5, 5, 1, 5, 1, 5, 1, 5, 5, 1, 5, 1, 5, 5, 1, 5, 5, 1, 5, 1, 5, 5, 1, 5, 1, 5, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 1, 5, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5

: / adm/,/halt/s/ characters to replace / characters to be replaced

Note: the backslash has the function of escape (% s for all rows g for all columns)

Vim split screen function

Ctrl + w / s up and down split screen

Ctrl + w v left and right split screen

Ctrl + w c close the screen where the cursor is located

Ctrl + w move the cursor up and down to the specified screen

Sp file2 edits both the current file and file2

Move the cursor in command mode

1 > move the gg cursor to the first line of the file

2 > the GG cursor moves to the end of the file

3 >: move the digital cursor to the specified location

Insert mode

I location of the cursor

I position of the beginning of the line where the cursor is located

O position of the next line of the cursor

O the previous line position of the line in which the cursor is located

An insert the next character of the character in which the cursor is located

An insert at the end of the line where the cursor is located

Delete and insert the character where the s cursor is located

Delete and insert the line of the S cursor

Vim exit mode

Q exit when the contents of the file have not been changed

: q! Force launch not to save, use when you do not want to save after changing the file

: wq exit save

: wq! Force exit save is used when writing a read-only file. Note that the edited read-only file must be the current user's file. The current user is root.

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