Linux vim 命令大全
2015-06-26 17:35
861 查看
在Linux上使用VIM,有很多命令,使用vimtutor查看命令指导手册。内容整理如下:
USING ALL OF THESE COMMANDS IN NORMAL MODEL!!!
:---enable to type commands at the bottom of scree.
:help---get help online document
:help+command
Ctrl+W---jump from one window to another
:q+<ENTER>---close the help window
:help vimrc-intro----to enable vim features by creating a vimrc file for some settings
for command completion: ":set nocp" to ensure no compatible model, and then ":e" and press CTRL+D to show all commands started by e. and <TAB> is to complete the commands or paraments.
vimtutor---a guidance of vim usage
vim---open vim software
vim filename---open file as filename in vim software, if the file doesn't exits, it will create a new file.
i---insert text into vim, change from Normal model to Insert model
h---cursor move left
l---cursor move right
k---cursor move up
j---cursor move down
:w---save the file to current path
:q---exit vim without any save
:wq---exit vim with file saved
:q!---forcely exit vim without any save
<for text changes>
x---delete the char at the cursor
a---cursor move to next char and text can be appended there
A---cursor jumps to the end of this line and text can be appened after this line.
i/a/A---all enter the INSERT model, the diff is where cursor is.
p---paste from jieqieban
0---move cursor to the start of line.
dd---delete a line. with 2dd to delete 2 lines.
dw---delete a word at the cursor, the cursor jumps to the next word.
de---delete a word at the cursor, the cursor jumps before the next word.
d$---delete a line from current cursor, if part of this line in next row, this part can't be deleted.
<for text changes>
u---undo last command.
U---undo all the changes on a line
Crtl+R---to undo the undo's
p---put previously deleted line after the current cursor line.
r---replace the char where cursor is with the char typed
R---replace many chars where cursor is with chars typed
ce---change the word to its end where cursor is with the chars typed
Ctrl+g---show file name and cursor location(help ruler) in file
G---move cursor to the end of file
gg--move cursor to the start of file
<number>+g---move cursor to the "number" line of file
/+phrase---search phrase from top to bottom in the file, search next by typing "n", search last by typing "N". Go back to where you came from by typing "Ctrl+o". "?+phrase" to search from bottom to top.
%---move cursor to the matched side of ()/[]/{}.
:s/old/new+/g---replace old with new. "/g" means do this command globally in the line.
:<#/%>s/old/new+/g---# is line type. if it's %, replace old with new globally in the file. to ask for confirmation, type "c" after "/g".
:set ic+ searchcommand---ignore the case upper or lower, ":set
noic" to disable ingnoring
:set hls is+ searchcommand---highlight the phrase that matched,
"nohlsearch" to disable highlight.
:!+external command---execute an external shell command
v---select text to write in a Visual model.
:r+filename---retrieve the file
:r !dir---show direction content
o---open a line in INSERT model after cursor line.
O---open a line in INSERT model above cursor line.
append commands: press e to move to the incomplete word, press a to append.then repeate it.
copy and paste: press v to enter VISUAL model, select text and press y to copy, then move cursor to the target line, press p to paste it there.
<operator><motion>---like dw, de, d$, for them, d is operator, and w/e/$ is motion.
<number><motion>---repeat the motion "number" times.
<operator>[number]<motion>---combination groups commands to be more powerful, for example, d/c is operator, w/e/$ is motion.
USING ALL OF THESE COMMANDS IN NORMAL MODEL!!!
:---enable to type commands at the bottom of scree.
:help---get help online document
:help+command
Ctrl+W---jump from one window to another
:q+<ENTER>---close the help window
:help vimrc-intro----to enable vim features by creating a vimrc file for some settings
for command completion: ":set nocp" to ensure no compatible model, and then ":e" and press CTRL+D to show all commands started by e. and <TAB> is to complete the commands or paraments.
vimtutor---a guidance of vim usage
vim---open vim software
vim filename---open file as filename in vim software, if the file doesn't exits, it will create a new file.
i---insert text into vim, change from Normal model to Insert model
h---cursor move left
l---cursor move right
k---cursor move up
j---cursor move down
:w---save the file to current path
:q---exit vim without any save
:wq---exit vim with file saved
:q!---forcely exit vim without any save
<for text changes>
x---delete the char at the cursor
a---cursor move to next char and text can be appended there
A---cursor jumps to the end of this line and text can be appened after this line.
i/a/A---all enter the INSERT model, the diff is where cursor is.
p---paste from jieqieban
0---move cursor to the start of line.
dd---delete a line. with 2dd to delete 2 lines.
dw---delete a word at the cursor, the cursor jumps to the next word.
de---delete a word at the cursor, the cursor jumps before the next word.
d$---delete a line from current cursor, if part of this line in next row, this part can't be deleted.
<for text changes>
u---undo last command.
U---undo all the changes on a line
Crtl+R---to undo the undo's
p---put previously deleted line after the current cursor line.
r---replace the char where cursor is with the char typed
R---replace many chars where cursor is with chars typed
ce---change the word to its end where cursor is with the chars typed
Ctrl+g---show file name and cursor location(help ruler) in file
G---move cursor to the end of file
gg--move cursor to the start of file
<number>+g---move cursor to the "number" line of file
/+phrase---search phrase from top to bottom in the file, search next by typing "n", search last by typing "N". Go back to where you came from by typing "Ctrl+o". "?+phrase" to search from bottom to top.
%---move cursor to the matched side of ()/[]/{}.
:s/old/new+/g---replace old with new. "/g" means do this command globally in the line.
:<#/%>s/old/new+/g---# is line type. if it's %, replace old with new globally in the file. to ask for confirmation, type "c" after "/g".
:set ic+ searchcommand---ignore the case upper or lower, ":set
noic" to disable ingnoring
:set hls is+ searchcommand---highlight the phrase that matched,
"nohlsearch" to disable highlight.
:!+external command---execute an external shell command
v---select text to write in a Visual model.
:r+filename---retrieve the file
:r !dir---show direction content
o---open a line in INSERT model after cursor line.
O---open a line in INSERT model above cursor line.
append commands: press e to move to the incomplete word, press a to append.then repeate it.
copy and paste: press v to enter VISUAL model, select text and press y to copy, then move cursor to the target line, press p to paste it there.
<operator><motion>---like dw, de, d$, for them, d is operator, and w/e/$ is motion.
<number><motion>---repeat the motion "number" times.
<operator>[number]<motion>---combination groups commands to be more powerful, for example, d/c is operator, w/e/$ is motion.
相关文章推荐
- [linux-kernel] 实现支持poll的驱动设备
- linux环境配置samba服务总结
- zeromq在linux上安装
- 每天进步一点点——linux——whereis
- CentOS6.5 64位网站压力测试工具webbench
- Linux进程通信之共享内存
- Linux引导层找回
- Linux学习笔记(六)——CentOS7初接触
- Linux内核编译过程
- 关于linux中文乱码的问题。
- Linux使用定时器消抖
- linux FIFO
- Linux学习笔记(五)——Linux目录配置
- 每天进步一点点——linux——which
- Linux学习笔记(四)——Linux档案权限
- linux系统日志函数syslog,openlog,closelog函数
- Linux下vsftp的安装及配置
- Linux system函数返回值
- Linux混杂设备驱动学习
- Linux下rar命令详解