Vim learning essays

(A) processing mode Vim

Command Mode

Copy, delete, paste, etc., by switching to the edit mode i / a isodesmic

Edit mode

Editing characters, switched by the Esc key

(B) Vim common commands

Create a file: Vim filename

Save the file :: w (first exit edit mode Esc)

Close the file:: q (first exit edit mode Esc)

Save and close the file:: wq (first exit edit mode Esc)

View files: cat filename

Vim copy / paste / delete

Copy: yy / yw (yy copy is a copy line yw is a word, as long as there is space after the word is considered to be a word)

Paste: p 

Delete: dd / dw (dd delete a row dw delete a word)

Cursor movement Vim

On the lower left Right: h / j / k / l (with the same vertical and horizontal-arrow)

Skip header: gg

Jump to end of file: G

The cursor line Vim

Move to the beginning of the line: ^

Moved to the end of the line: $

Mobile by word: forward w / 2w /, rearward b / 2b / (2w / forward movement of the two words, 2b move backward two words)

Vim Find and Replace

Find Keyword: / Keyword 

Want to find a keyword click on a keyword n ​​shift + n

Find and replace ::% s / keywords / replacement word / gc (g: globe, indicates global replacement c: confirm, represents confirmation)

Alternatively specified range :: 21,23s / keywords / replacement word / GC (alternatively between lines 21 to line 23)

Set the line number :: set number

Vim multi-window

:: split or sub-window: vsplit (: split split lateral window: vsplit longitudinally divided windows)

Jump between the windows: ctl + ww or ctl + w [hjkl]

Guess you like

Origin www.cnblogs.com/MiYa0219/p/12165320.html