首页 > 代码库 > linux----vi
linux----vi
vi------http://www.cs.colostate.edu/helpdocs/vi.html
查找:
/string | search forward for occurrence of string in text | |
---|---|---|
?string | search backward for occurrence of string in text | |
n | move to next occurrence of search string | |
N | move to next occurrence of search string in opposite direction |
退出:
:r filename<Return> | read file named filename and insert after current line (the line with cursor) |
|
---|---|---|
:w<Return> | write current contents to file named in original vi call | |
:w newfile<Return> | write current contents to a new file named newfile | |
:12,35w smallfile<Return> | write the contents of the lines numbered 12 through 35 to a new file named smallfile | |
:w! prevfile<Return> | write current contents over a pre-existing file named prevfile |
:x<Return> | quit vi, writing out modified file to file named in original invocation | |
---|---|---|
:wq<Return> | quit vi, writing out modified file to file named in original invocation | |
:q<Return> | quit (or exit) vi | |
:q!<Return> | quit vi even though latest changes have not been saved for this vi call |
删除:
*
x | delete single character under cursor | |
---|---|---|
Nx | delete N characters, starting with character under cursor | |
dw | delete the single word beginning with character under cursor | |
dNw | delete N words beginning with character under cursor; e.g., d5w deletes 5 words |
|
D | delete the remainder of the line, starting with current cursor position | |
* | dd | delete entire current line |
Ndd or dNd | delete N lines, beginning with the current line;
e.g., 5dd deletes 5 lines |
复制粘贴:
yy | copy (yank, cut) the current line into the buffer | |
---|---|---|
Nyy or yNy | copy (yank, cut) the next N lines, including the current line, into the buffer | |
p | put (paste) the line(s) in the buffer into the text after the current line |
linux----vi
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。