vi note

来源:互联网 发布:美国学建筑知乎 编辑:程序博客网 时间:2024/05/16 08:55

#modify
1) r|R
r:replace single char
R:replace char until [ESC] pressed.
2)c|C
c: c[num]w = [num]cw :change num words.
cc;change one line.   ... test c[num]b  c0 c$=C
3)s: [num]s substitute num chars. 

----------------------------------------------------------
#set
set opt
set noopt
eg. set number ,set nonumber 
set rtp:show vim runtimepath.

#cursor
[num]L:move to n lines above screen end,0 is default.
M:screen middle
[num]H:move to n lines below screen top,0 is default.
<CR>=+=^:to next line beginning.
-:like + (up).
(num)|:goto the num column of the current line.
[num]h|j|k|l :[num]h|l move left|right num chars.
[num]j|k  jump num lines
(num)G = :num<CR> goto the num line.
gg <-> G :goto the file start<->end position.
w|W: w move forward one word,the same too W. but 'w' recognized a word by special char(not a-z|A-Z) ,W recognized a word by space char.
b|B:move backward. like w|W .
//CTRL=^
^F:Scroll forward one screen
^B:like ^F(backward )
^D:Scroll forward half screen(down)
^U:like ^D(up)

test:e|E (|) {|} [[|]]

#searches
basic /|?
f|F x:Find (move cursor to) next|previous  occurrence of x in the line, where x stands for any character.
t|t x :Find (move cursor to) character befor|after previous occurrence of x in the line.
;|, :Repeat previous find command in same|opposite  direction.

vi +/pattern file : open file at the fist occourrence of 

#
. :execute the last edit operating

#
J:jion two lines.

#
num!!sort
#comment
map zmd :r !echo -n "/* "$USER" modify  “ `date`  " */"<CR>

map zmd :r !read ARGVS && echo -n "/* "$USER" "$ARGVS" " `date`  " */"<CR>


原创粉丝点击