[Linux] vi, vim
Others
2022-04-22 04:55:43
views: 0
vi, vim three mode conversion
Shortcuts for vi and vim
- Copy the current line
yy
, copy the five lines below the current line 5yy
, and paste p (in normal mode)
- Delete the current line
dd
, delete the 5 lines below the current line 5dd
. (In normal mode)
- Find a word in the file:
:/关键字
, Enter to find, enter n to find the next (in command line mode).
- Set file line number:
:set number
; Cancel file line number :set nonu
. (in command line mode)
- The last line
G
of text, the first line of text gg
. (in normal mode)
- In edit mode, enter a string to undo. First, ESC exits the editing mode and becomes the normal mode. Press
u
it to cancel.
- Quickly locate the line number: in normal mode, enter
行号 shift+g
to quickly locate the specified line
Origin http://43.154.161.224:23101/article/api/json?id=324827075&siteId=291194637