• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆-145  評(píng)論-173  文章-70  trackbacks-0
            最近在學(xué)習(xí)Vimtutor中的相關(guān)內(nèi)容,Vim的使用博大精深,很多命令一旦不使用就會(huì)忘記,下面把其中的沒有使用到的相關(guān)命令做一個(gè)簡單的總結(jié),供以后復(fù)習(xí)使用。至于常見的保存,插入等等命令,則不予記錄,在以后的使用中加深練習(xí)即可。
             
            1. Type  0  (zero) to move to the start of the line.
             Type  2w  to move the cursor two words forward.
             Type  3e  to move the cursor to the end of the third word forward.

            2. Type  x  to delete the first unwanted character.
             Type  rx  to replace the character at the cursor with  x
             
            3. To change until the end of a word, type  ce (ce + 修正的單詞)
             
            4. C就類似于d。de,dw,d$都對(duì)應(yīng)著ce,cw,c$
             
            5. Type CTRL-G to show your location in the file and the file status.
                 Type  G  to move to a line in the file.
                 
            6. Press  G  to move you to the bottom of the file.
                 Type  gg  to move you to the start of the file.

            7. Type  /  followed by a phrase to search for the phrase.
             
            8. To search for the same phrase again, simply type  n .
                 To search for the same phrase in the opposite direction, type  N      
                 
            9. To search for a phrase in the backward direction, use  ?  instead of  /     
                 
            10. To go back to where you came from press  CTRL-O      
                 
            11. 匹配使用%,放置在一個(gè)括號(hào)下面,然后輸入%,就會(huì)跳轉(zhuǎn)到另外一個(gè)上面。    

            12.  type   :#,#s/old/new/g    where #,# are the line numbers of the range
                                           of lines where the substitution is to be done. (兩行之間的所有文本)
                 Type   :%s/old/new/g      to change every occurrence in the whole file.(不提示,但是是整個(gè)文件)
                 Type   :%s/old/new/gc     to find every occurrence in the whole file,
                                           with a prompt whether to substitute or not.(提示是否代替)
                                           
            13.g表示取代該行所有的。
             比如:s/thee/the/g表示取代該行中所有的thee為the。                              
                                           
            14. CTRL-G  displays your location in the file and the file status.
                         G  moves to the end of the file.
                 number  G  moves to that line number.
                        gg  moves to the first line.
                                           
                                           
            15. :! 運(yùn)行執(zhí)行外部程序。(冒號(hào)是必須的,命令模式都必須的,比如:w表示保存) (外部命令如ls,pwd需要使用!,而內(nèi)部命令則是直接:w等等,不需要使用!)                         
                                           
            16. 輸入v進(jìn)入視覺模式,此時(shí)鼠標(biāo)向下會(huì)選中部分文字,然后可以對(duì)選中的文字操作。
            比如:w TEST則會(huì)把選中的保存位文本。
            :d則會(huì)刪除選中的文本。                               
                                           
            17. 插入一個(gè)文件的部分內(nèi)容,使用:r FILENAME即可插入一個(gè)文件到該行。                              
             
            18. 在下方新建一個(gè)空行,使用o,
             在上方新建一個(gè)空行,使用O。(命令模式下)    (輸入命令后會(huì)進(jìn)入插入模式)
                 
            NOTE:  a, i and A all go to the same Insert mode, the only difference is where
                   the characters are inserted.(a是在光標(biāo)后,A是在行末尾,i則是光標(biāo)處)

            19. e跳轉(zhuǎn)一個(gè)單詞。e.g: 2e表示跳轉(zhuǎn)兩個(gè)單詞,比向右鍵更快捷。
                G跳轉(zhuǎn)行。e.g: 721G表示跳轉(zhuǎn)到第721行
                 
                 
            20. 替換:
            R:替換位多個(gè)字母
            r:替換位單個(gè)字母     
                 
            21. Move the cursor to the end of the next line:  j$
             
             
            22. Use the  y  operator to copy text and  p  to paste it

            NOTE: you can also use  y  as an operator;  yw  yanks one word.

             
            23. Set the 'ic' (Ignore case) option by entering:   :set ic(包含大小寫匹配的都顯示出來,比如Ignore,IGNORE)
                Set the 'hlsearch' and 'incsearch' options:  :set hls is(高亮顯示)


            (set option)
            24. Typing ":set xxx" sets the option "xxx".  Some options are:
                    'ic' 'ignorecase'       ignore upper/lower case when searching
                    'is' 'incsearch'        show partial matches for a search phrase
                    'hls' 'hlsearch'        highlight all matching phrases
                 You can either use the long or the short option name.

            25. Prepend "no" to switch an option off:   :set noic
             
               
            26. 在命令模式下,輸入e然后按TAB鍵,會(huì)自動(dòng)出現(xiàn)很多相關(guān)的命令(以e開頭的命令)。(第一個(gè)相關(guān)的)
            按Ctrl + D能夠出現(xiàn)所有以他開頭的命令。     
                 
                 
                
            posted on 2011-10-05 17:53 deercoder 閱讀(14867) 評(píng)論(4)  編輯 收藏 引用 所屬分類: Vim

            評(píng)論:
            # re: Vim學(xué)習(xí)筆記 2011-10-05 19:13 | 畢達(dá)哥拉斯半圓
            不錯(cuò),收藏了!  回復(fù)  更多評(píng)論
              
            # re: Vim學(xué)習(xí)筆記 2011-10-06 17:09 | 雙星休閑鞋
            可以好好的研究下。  回復(fù)  更多評(píng)論
              
            # re: Vim學(xué)習(xí)筆記 2011-10-09 14:04 | coreBugZJ
            贊!!學(xué)習(xí)學(xué)習(xí)  回復(fù)  更多評(píng)論
              
            # re: Vim學(xué)習(xí)筆記 2011-10-18 00:09 | 劉暢
            久久精品中文字幕大胸| 亚洲人成精品久久久久| 久久精品免费大片国产大片| 久久伊人影视| 嫩草伊人久久精品少妇AV| 久久亚洲综合色一区二区三区| 国产精品永久久久久久久久久 | 7777精品久久久大香线蕉| 久久午夜羞羞影院免费观看| 国产精品嫩草影院久久| 久久精品国产免费观看| 精品久久久久久久久久中文字幕| 精品国产乱码久久久久软件| 亚洲国产二区三区久久| 无码人妻久久久一区二区三区| 亚洲一本综合久久| 久久国产高清字幕中文| 国产午夜精品久久久久九九电影| 综合久久一区二区三区| 97久久精品国产精品青草| 欧美麻豆久久久久久中文| 青草影院天堂男人久久| 色综合久久无码五十路人妻| 精品久久久久久无码不卡| 91精品国产高清久久久久久91| 少妇人妻88久久中文字幕| 亚洲精品无码久久久| 久久国产V一级毛多内射| 91精品国产综合久久精品| 伊人久久大香线蕉亚洲| 亚州日韩精品专区久久久| 久久久久国产亚洲AV麻豆| 日本免费久久久久久久网站| 国产精品欧美久久久天天影视| 久久亚洲中文字幕精品有坂深雪 | 一本久久久久久久| 国产精品久久自在自线观看| 99久久国产热无码精品免费| 69SEX久久精品国产麻豆| 青青青国产精品国产精品久久久久 | 久久综合亚洲鲁鲁五月天|