登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

学会放手

-- By Vincent Chen

 
 
 

日志

 
 

VI the universal UNIX editor  

2005-08-29 10:54:31|  分类: IT |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
 

Here is a brief description of groups of vi commands and their functions:

     Paging Commands

          <CTRL/F>     Pages forward one screen.

          <CTRL/B>     Pages back one screen.

          <CTRL/D>     Pages down half screen.

          <CTRL/U>     Pages up half screen.

     Cursor Positioning Commands

          arrows       Moves cursor in the direction of the arrow

          <RETURN>     Moves cursor to beginning of next line.

          0            Moves cursor to beginning of current line.

          $            Moves cursor to end of current line.

          <SPACE>      Moves cursor forward one character.

          /pattern     Moves cursor forward to next occurrence of "pattern"

          ?pattern     Moves cursor backward to next occurrence of "pattern"

          n            Repeats last / or ? pattern search.

          :n           Moves to line number n
 
     Text Insertion Commands

          i            Inserts text before cursor. Terminated by <ESC>.

          o            Opens new line below the current line for text inser-
                       tion. Terminated by <ESC>.

          <ESC>        Stops text insertion.

     Text Deletion Commands

          dw           Deletes current word.

          x            Deletes current character.

          dd           Deletes current line.

          P            Puts back text from the previous delete.


     Buffer Usage Commands

          n yy         Yanks n lines to the  buffer.  Default is current
                       line.  When a line is Yanked, it copies the line
                       to a buffer and leaves the original lines within
                       the text file.

          n p          Puts n yanked text lines from the buffer, after
                       the cursor.

     Exiting vi

          :wq          Writes changes to current file and quits edit session.

          :q           Quits edit session (no changes made).

Once you start editting a file using vi (vi filename), you can use the cursor movement and paging commands to move around your file. You can also use the text delete and buffer commands to remove or move pieces around.
When you want to insert text, you MUST type "i". When you are done inserting text, you MUST hit the escape key. If you try using the arrows keys or other cursor movement commands, and have not hit the escape key when inserting, you will get funny characters in your file.
When you are done editting your file, simply type ":wq", to write and quit the vi session.
Please read the manual pages (man vi) for a complete list on vi functions.

  评论这张
 
阅读(71)| 评论(1)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018