标签:
match the whole word(eg: match printf but not snprintf/fprintf)
You can use \< to match the beginning of a word and > to match the end:
%s/\<printf\>/PRINTF/gc
match the current line to last line of file
.,$s/printf/PRINTF/gc
match the current line to the next two line of file
.,+2s/printf/PRINTF/gc
replace word contain /, eg. printf->//print
:s!printf!//printf!gc
链接地址
If you want to do the same thing to a collection of lines, like cut, copy, sort, or format, you first need to select the text. Get out of insert mode, hit one of the options below, and then move up or down a few lines. You should see the selected text highlighted
Key | description |
---|---|
V | selects entire lines |
v | selects range of text |
ctrl-v | selects colums |
gv | reselect block |
Key | description |
---|---|
ctrl-n | next word completion(similar word in current file |
ctrl-p | previous word completion(similar word in current file |
ctrl-x, ctrl-l | line completion |
ctrl-w | erases word (insert mode) |
ctrl-u | erases line ... or on command line |
when we command set path value
:set dictionary=/usr/share/dict/words
then, ctrl-x, ctrl-k, the dictionary completion
链接地址
Use markers to set places you want to hotfoot get back to, or to specify a block of text you want to copy or cut.
key | description |
---|---|
ma a | mark current position as mark a(can use a-z) |
‘k | move to mark k |
d‘k | delete form current positon to mark k |
‘a-z | same file |
链接地址
These are useful to reformat text paragraphs or chunks of code (NOTE: This does not python code ...)
key | description |
---|---|
V= | select text, then reformat with = |
= | will correct alignment of code |
== | one line |
gq | reformat paragraph |
链接地址
Use folds to collapse selected blocks. Useful if you have finished a subroutine and want to save window space, or maybe want to fold allboocks of comments
key | description |
---|---|
zo | open current scope fold |
zc | close current scope fold |
zO | open current scope fold and sub scope fold |
zC | close current scope fold and sub scope fold |
Ctrl
+V
to select the first column of text in the lines you want to comment.shift
+i
and type the text you want to insert.Esc
wait 1 second and the inserted text will appear on every line.标签:
原文地址:http://www.cnblogs.com/xiao13149920yanyan/p/4481447.html