Vim experience summarized by myself
2013-01-10 11:01:27
Thanks KEVIN: http://v.youku.com/v_show/id_xndgwnjq3mda4.html? F = 18603562
Vim-008
Command + Motion
1) c B deletes the word forward and enters the insert mode.
2) D 3 J Delete the following three rows
3) delete d g to the end
4) delete D 0 to the beginning of the row
5) d $ last to end of line
Command d c y v available
Vim -- 009
Text objects
2) v I w: inner
V a w selected words and spaces A: A/
2) v I p selected paragraph
V a p: The selected section contains spaces.
3) v I (select the brackets
V I {selected braces
V I "selected quotation marks
C A "deletes the quotation marks (including quotation marks) and enters the insert mode.
C I "removes quotation marks (excluding quotation marks) and enters the insert mode.
Vim -- 010
3) review previous content
Move cursor H J K L
Move the screen up/down <shift> H M L
Find f * Find a letter and move it there
F * forward lookup
Run the last command;
2) You can switch the focus using o in <visual> mode.
V a s select a sentence
Vim -- 011
Vim personalized settings
4) set colorscheme to set the color
Set number
Set nowrap does not automatically wrap
Set textwidth to set automatic line feed. You can enter the longest character.
Set laststatus = 2 split command lines and files
Set incsearch to set incremental search
Set ingorecase
Vim -- 012
How to find
5 1)/* search for n/n forward and backward.
? * Backward Search
2) Regular Expression
/^ Search for a row with the first line
\ W * Several Characters
Vim -- 013
Vim replacement
6 1): S/S1/s2
: S/S1/s2/g Replace the entire S1 WITH S2
: % S/S1/s2/GI case-insensitive global replacement
: N1, N2 S/S1/s2/g n1-n2 replacement
Vim -- 014
Vim replacement
Substitute: [range] S/pattern/string/[flags]
[Range] % 1-last line
3,6 3-6
1,. 1-current line
., $ Current line-last line
., + 5 current line & next 5 line
-5,. Current Line & uper 5 line
If the replacement is the same for the last run, the pattern can be omitted.
Thanks again to http://v.youku.com/v_show/id_XNDgwNjQxMzky.html? F = 18603562