Vim操作练习


晚上回来之后闲来无事,东翻翻西翻翻的,找到了之前下载的一篇《Vim tutorial》,发现了一些自己之前没怎么注意到的命令,值得学习,就此记录一下:

CTRL-F  #向下翻一页
CTRL-B  #向上翻一页
CTRL-D  #向下翻半页
CTRL-U  #向上翻半页

{  #Go to the beginning of current paragraph
}  #Go to the beginning of next paragraph
(  #Go to the beginning of previous sentence
)  #Go to the beginning of next sentence
%  #Jump to the matching {..} or (..)

w  #Go to the beginning of next word
W  #Go to the beginning of next WORD
e  #Go to the end of current word
E  #Go to the end of current WORD
b  #Go to the beginning of previous word
B  #Go to the beginning of previous WORD
0  #(zero) Go to the starting of current line
$  #(dollar) Go to the end of current line

H  #Go to the first line of current screen
M  #Go to the middle line of current screen
L  #Go to the last line of current screen
zz #Redraw the screen with the current line under the cursor at the middle of the screen

:jumps     #view the jump list
CTRL-O     #Jump back to previous spot
CTRL-I     #Jump forward to next spot
gf         #Go to file(跳转至光标所在处文件)
CTRL-W gf  #Go to file with open new tab
gg=G  #format the entire buffer(格式化常用)

:g/PATTERN/d  #Delete the line which has a specific pattern
:v/PATTERN/d  #Delete the line which doesn’t has a specific pattern{非常有用}
:g/^$/,/./-j  #Reduce multiple blank lines into a single blank line
:g/^/m0       #Reverse a file{将文件内容的所有行反转了,类似于tac命令}

插入操作:

insert_in_vim


《 “Vim操作练习” 》 有 3 条评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注