vi笔记2——vi之简单编辑
来源:互联网 发布:战国水晶杯 知乎 编辑:程序博客网 时间:2024/06/05 12:26
vi笔记2——vi之简单编辑
vi 简单编辑主要包含以下内容:
• Moving the cursor
• Adding and changing text
• Deleting, moving, and copying text
• More ways to enter insert mode
相关命令说明如下:
c,d,y can use like this(number)(cmd)(text object)(cmd)(number)(text object)a --append text after cursorA or $a --append text at the end of the linec 命令行下使用c,就会从光标处清除相应的字符cc --to replace the entire current line,equal to S(large)C(large c) --equal to c$ ,replace words from current cursor to the end of the linecw --To the end of a wordc2b --Back two wordsc$ --To the end of linec0 --To the beginning of lined --deletendd --delete n lines from current lined2w 2dw --delete two wordsdb --delete backwardD or d$ -- deletes from the cursor position to the end of the lined0 -- delete to the beginning of a linede --To retain the space between words, use de, which deletes only to the end of a word.dE --deletes to the end of a word, including punctuation.ngg --go to line n,equal to nG1gg --go to line 1,equal to command mode(:1)$g or G --go to the last line of the file,equal to command mode(:$)nh --move n space to the lefti --insert before the corsortyping 25a*- or 25i*- ESC appends or inserts 50 characters (25 pairs of asterisk and hyphen). I --insert at the head of a linenj --down n linesJ --join,Joining Two Lines with J,nJ will join n linesnk --up n linesnl --right n spaceo(small o) --Open blank line below cursor for text.create a new line after current line,and be inserting mode O(large O) --Open blank line above cursor for text.create a new line before current line,and be inserting modep --put, d x yy后的缓存数据可以直接用来粘贴If you delete one or more lines, p puts the deleted text on a new line(s) below the cursor. If you delete less than an entire line, p puts the deleted text into the current line, after the cursor.r or R-- (replace)选中某个字符,并且设置为可改变状态,如:rs将选中的字符变为s,rw将选中的字符变为w,2rs将两个字符变为sR (“large” replace) is useful when you want to start changing text, but you don’t know exactly how much.小r只能替换一个字符,大R可以从当前光标处不停的替换s(small s) --Substituting text,substitute a single character,and be inserting modens will substitute n charactersS(large s) --lets you change whole lines,equal to cc,put you in inssert modenS --change n lines,equal to nccu --undo,undo your last undo with u,如果误删了数据,如dd某一行,可以使用u来撤销上一次的命令,p命令也可以粘贴删除的内容(x dd等内容在缓存中,用可以p来粘贴),(VI)page 296 has more undoing functions.U, the uppercase version of u, undoes all edits on a single line, as long as the cursor remains on that line. Once you move off a line, you can no longer use U.Vim lets you use CTRL-R to “redo” an undone operation.w word,以一个块为单位的移动x --deletes only the character the cursor is onnx --delete n characters from the cursornX --delete n characters before the cursor说明:点(.),当使用x后点和小x一样删除光标右边的,当使用大X后点和大X一样删除光标左边的 y --yanknyy or nY --copy n linesyw --copy one wordy$ --copy to the end of a liney0 --copy to the begin of a line~ --The tilde (~) command will change a lowercase letter to uppercase or an uppercase letter to lowercase..(dot) --Repeating or Undoing Your Last Commandsummary:Table 2-1. Edit commandsText object Change Delete CopyOne word cw dw ywTwo words,not counting punctuation 2cW or c2W 2dW or d2W 2yW or y2WThree words back 3cb or c3b 3db or d3b 3yb or y3bOne line cc dd y or YTo end of line c$ or C d$ or D y$To beginning of line c0 d0 y0Single character r x or X yl or yhFive characters 5s 5x 5ylTable 2-2. MovementMovement Commands← , ↓ , ↑ , → h, j, k, lTo first character of next line +To first character of previous line -To end of word e or EForward by word w or WBackward by word b or BTo end of line $To beginning of line 0Table 2-3. Other operationsOperations CommandsPlace text from buffer P or pStart vi, open file if specified vi fileSave edits, quit file ZZ or :wqNo saving of edits, quit file :q!Table 2-4. Text creation and manipulation commandsEditing action CommandInsert text at current position iInsert text at beginning of line IAppend text at current position aAppend text at beginning of line AOpen new line below cursor for new text o(小写字母 欧)Open new line above cursor for new text O(大写字母 欧)Delete line and substitute text SOverstrike existing characters with new text RJoin current and next line JToggle case ~Repeat last action .Undo last change uRestore line to original state U
以上是学习vim时候整理的一些要点,分享此处以供学习!
对于一些想深入学习vi的人群,可以参考以下图书:Learning.the.vi.and.Vim.Editors.7th
下载链接:http://download.csdn.net/detail/u011127242/9617946 0 0
- vi笔记2——vi之简单编辑
- vi笔记3——vi之快速移动
- vi笔记4——vi之超越基础
- 学习vi编辑器 —— vi文本编辑器和简单编辑
- vi笔记1——vi之配置一个强大的vi/vim
- shell学习笔记(二)—— vi 编辑工具
- 简单的vi编辑命令
- ubuntu之VI编辑命令
- 【linux】文件编辑之vi
- 学习vi编辑器 —— 高级编辑
- Vi指令大全—-编辑文件
- Linux学习—退出vi编辑模式
- Linux学习—退出vi编辑模式
- Linux学习—退出vi编辑模式
- Linux学习—退出vi编辑模式
- vi编辑
- vi —— 简单命令
- vi笔记附录1——vi之配置一个强大的c语言、python IED
- C++ Prime 简单回顾-基础知识
- 四、ASP文件的基本格式及新建方法
- 五、asp常用对象
- Peeking Iterator
- eclipse里maven项目An error occurred while filtering resources解决办法
- vi笔记2——vi之简单编辑
- Kubernetes单Pod操作
- PL/SQL 配置登陆名失败的原因
- 【操作系统】课程主页
- maven的settings.xml配置
- tomcat 访问其他目录
- 寻找测试用例以及最终的结果是修改他的数据
- poj1486Sorting Slides【二分图匹配判断是否是必须】
- 求数组中数的最大值、最小值(C语言)