Use the editor

vim editor

 h : Shift left one character.
 j : Move down one line (the next line in the text).
 k : Move up one line (the previous line in the text).
 l : Move one character to the right.

 PageDown (or Ctrl+F): Scroll down one screen.
 PageUp (or Ctrl+B): Page up one screen.
 G ​​: Move to the last line of the buffer.
 num G : Move to line num in the buffer.
 gg : Move to the first line of the buffer.

 q : Exit if buffer data is not modified.
 q! : Cancel all modifications to buffer data and exit.
 w filename : Save the file to another file.
 wq : save buffer data to file and exit.

Edit data

copy and paste

The copy command in vim is y (for yank). The same second character as the d command can be used after the y (yw means copy a word, y$ means copy to the end of the line). After copying the text, move the cursor to where you want to place the text and enter the p command. The copied text will appear there.

Multi-line comments:

shift + v visible line

ctrl + v visual block

shift + i to insert

Esc

find and replace

The replace command allows you to quickly replace a word in text with another word. You must be in command line mode to use the substitution command. The format of the replace command is:
:s/old/new/
The vim editor will jump to the first occurrence of old and replace it with new. The replace command can be modified to replace multiple places of text.
 :s/old/new/g : Replace all old with one line command.
 :n,ms/old/new/g : Replace all old between line numbers n and m.
 :%s/old/new/g : replace all old in the whole file.
 :%s/old/new/gc : replace all old in the whole file, but prompt on every occurrence

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325260166&siteId=291194637