免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1330 | 回复: 0
打印 上一主题 下一主题

Vi Control Keys [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-24 06:08 |只看该作者 |倒序浏览

               
       
       
       
       
       
       
       
       
               
                        File Manipulation
                        Line Positioning
                       
               
                        Undo previous change
                        u,u
                        Top/Last/Middle line on screen
                        H,L,M
               
               
                        Exit vi, saving changes if modified
                        ZZ
                        Next (Previous) line, at first non-white space character
                        + or , -
               
               
                        (Forced)Write back changes
                        :w(!)
                        Next (Previous) line, same column
                        j,k | down/up
               
               
                        Write/Overwrite file name
                        :w(!) name
                        Character Positioning
                       
               
                        Quit, discarding changes (Forced)
                        :q(!)
                        Beginning (End) of line
                        0, $
               
               
                        Edit file name | Reedit, discard changes
                        :e name | :e!
                        First non-white space character
                        ^
               
               
                        Edit, starting at end | Edit, starting at line n
                        :e + name | :e +n
                        Forward (Backward)
                        l,h or ->,
               
               
                        Edit alternate file (, discard changes)
                        :e(!) #
                        Backspace, Space bar
                        ^H, space
               
               
                        Run shell | command, then return
                        :sh | :!cmd
                        Find next (previous) x
                        f(F)x
               
               
                        Edit next file in arglist | specify new arglist
                        :n | :n args
                        Move to character following the next(previous) x
                        t(T)x
               
               
                        Show current file and line
                        ^G
                        Repeat last(inverse) of last f,F,t, or T
                        ;,'
               
               
                        Position cursor to tag
                        :ta tag
                        Move to column n
                        ,n|
               
               
                        Positioning Within a File
                        Find matching () or {}
                        %
               
               
                        Forward/Backward screen
                        ^F, ^B
                        Words, Sentences, Paragraphs
                       
               
                        Scroll down/up half screen
                        ^D, ^U
                        Forward (Back) a word
                        w,b
               
               
                        Go to the beginning of the specified line
                        #G
                        Forward (Back) a blank-delimited word
                        W, B
               
               
                        Next (Previous) line matching pattern
                        /(?)pattern
                        End of a (blank-delimited) word
                        e,W
               
               
                        Repeat(Reverse) last / or ? Command
                        n,N
                        To next (previous) sentence
                        ),(
               
               
                        ,nth line after (before) pattern
                        /pat/+n,?pat?-n
                        To next (previous) paragraph
                        },{
               
               
                        Next (Previous) section/function
                        ]], [[
                        Corrections During Insert
                       
               
                        Beginning (End) of sentence | Paragraph
                        (, ) | {,}
                        Erase last character (word)
                        ^H, ^W
               
               
                        Find matching () or {}
                        %
                        Interrupt, suspends insert mode
                        CTRL-C
               
               
                        Adjusting the Screen
                        Ends insertion, back to command mode
                        ESC
               
               
                        Clear and redraw window (if ^L is ->key)
                        ^L(, ^R)
                        Backtab on character, reset left margin of autoindent
                        CTRL-D
               
               
                        Redraw screen with current line at top/bottom/center of window
                        z/z-/z.
                        Insert and Replace
                       
               
               
                        Move pattern line to bottom of window
                        /pat/z-
                        Append after cursor/at end of line
                        a/A
               
               
                        Use n-line window
                        zn.
                        Insert before cursor/first non-blank
                        i/I
               
               
                        Scroll window down(up) one line
                        ^E,^Y
                        Open line below/above
                        o/O
               
               
                        Marking and Returning
                        Replace single character with x
                        ,rx
               
               
                        Mark current position with the ASCII lower-case letter x
                        ,mx
                        Replace characters
                        Rtext
               
               
                        Move to mark x
                        `x
                        Copy & Paste
                       
               
                        Operators
                        Copy 3 lines/characters
                        3yy/3yl
               
               
                        Delete/change/yank lines to buffer
                        d/c/y
                        Copy to/paste from buffer x
                        “xy/”xp
               
               
                        Left shift/Right shift/Filter through command
                        /!
                        Paste back text after/before cursor
                        p/P
               
               
                        Miscellaneous Operations
                        Delete into buffer x
                        “xd
               
               
                        Change/Delete rest of line
                        c$/d$
                        Undo, Redo, Retrieve
                       
               
                        Substitute characters/lines
                        cl/cc
                        Undo last change
                        u
               
               
                        Delete characters (before cursor)
                        dl(dh)
                        Restore current line
                        U
               
               
                        Join/Yank lines
                        J/yy
                        Repeat last change
                        .
               
               
                       
                       
                       
                       
               
               
                        /usr/bin/vi [-r filename] [-R] [-wn]
                       
                       
                       
               
               
                        -r: recovery file; -R: readonly; -wn: set the default window size to n
                       
               
                       
                       
                       
                       
               
               
                        ' sed -e “/^$/d” filename -- remove all blank lines from a file
                       
               
                        :set – show all vi varibles; :set nu/nonu – show line number; :set smd – show status
                       
       
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/40653/showart_366498.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP