linux vi/vimの使い方

15593 ワード

1.  http://linux.vbird.org/
鸟哥ここにはviがあるものがとてもそろっています。
 
2.vimマルチラベル処理「転」
 
1、           

   Vim    "vim -p filename ..."
:tabe[dit]                              *:tabe *
 *:tabedit *
 *:tabnew *

:tabnew                            。

:tabe[dit] [++opt] [+cmd] {file}

:tabnew [++opt] [+cmd] {file}

                          {file}
,    |:edit
|   。

:tabf[ind] [++opt] [+cmd] {file}
                        *:tabf *
 *:tabfind *

                          'path'    {file}
,    |:find
|   。
                {        |+file_  パス |      }


:[count]
tab {cmd}
                                       *:tab *

                   {cmd}
,        ,        。    
                |:diffsplit
|、|:ディフpatch
|、|:execute
|   |:normal
|。
                     [count]
,             。    
                [count][count]
       。":0tab cmd"  
                            。  :
 :tab split "              

 :tab help gt "         "gt"     2、 
         

                                                        *:tabc *
 *:tabclose *

:tabc[lose][!]         。
                          :
                -           。                                *E 784 *

                -    'hidden'     ,   [!],      ,      
                        。
                           ,     。         "   "
                  。

:tabc[lose][!] {count}

                    {count}
     。         ':tabclose'   。

                                                        *:tabo *
 *:tabonly *

:tabo[nly][!]             。
                     'hidden'   ,              。
                       'hidden'     'autowrite'   ,       
                  。  ,                 。     
                [!],        。              ,    
                        。
 3、別のタブに切り替えます。
:tabn[ext]                              *:tabn *
 *:tabnext *
 *gt *

<C-PageDown>
                            *CTRL-<PageDown> *
 *<C-PageDown> *

gt                                      *i_CTRL-<PageDown> *
 *イ_C-PageDown> *

                        。              。

:tabn[ext] {count}

{count}
<C-PageDown>

{count}
gt           {count}
     。         1。


:tabp[revious]                          *:tabp *
 *:tabprevious *
 *gT。 *
 *:tabN *

:tabN[ext]                              *:tabNext *
 *CTRL-<PageUp> *

<C-PageUp>
                       *<C-PageUp> *
 *i_CTRL-<PageUp> *
 *イ_C-PageUp> *

gT                      。             。

:tabp[revious] {count}

:tabN[ext] {count}

{count}
<C-PageUp>

{count}
gT            {count}
     。             。

:tabr[ewind]                    *:tabfir *
 *:tabfirst *
 *:ta br *
 *:tabreew ind *

:tabfir[st]             。

                                                        *:tabl *
 *:tablast *

:tabl[ast]               。

 4、    :

                                                        *:tabs *

:tabs                        。
                       ">"。
                          "+"。


5、             :


:tabm[ove] [N]                                          *:tabm *
 *:tabmove *

                          N       。  0            
                  。     N,           。


6、                 :


                                                        *:tabd *
 *:tabdo *

:tabd[o] {cmd}
           {cmd}
。
                     :
 :tabfirst

 :{cmd} 

 :tabnext

 :{cmd} 

   

                                。           ,  
                          。
                        (         )        。
                {cmd}
      '|'        。
                {cmd}
        、           。
                {Vi     } 
 {        |+listcmds |      }

                   |:ウィンド
|、|:argdo
|   |:bufdo
|。


VIM     :

   
:[addr]s/ / /[option]
::%s/ / /g
[addr] , 。
:“1,20” : 1 20 ;
“%” : , “1,$”;
“. ,$” : ;
s :
[option] : 
:g ; 
c
p (Ctrl + L );
option ;
, ”\”
# That or this This or that
:%s/\(That\) or \(this\)/\u\2 or \l\1/
—- 
# child children
:%s/child\([ ,.;!:?]\)/children\1/g
—-
# mgi/r/abox mgi/r/asquare
:g/mg\([ira]\)box/s//mg//my\1square/g    <=>  :g/mg[ira]box/s/box/square/g
—-
#
:%s/  */ /g
—-
#
:%s/\([:.]\)  */\1 /g
—-
#
:g/^$/d
—-
#
:g/^[  ][  ]*$/d
—-
#
:%s/^/>  /
—-
# 6 .
:.,5/$/./
—-
#
:g/.*/m0O  <=> :g/^/m0O
—-
# ,
:g!/^[0-9]/m$ <=> g/^[^0-9]/m$
—-
# 12 17 10
:1,10g/^/12,17t$
~~~~
—-
# chapter begin
:g/^chapter/.+2w>>begin
—-
:/^part2/,/^part3/g/^chapter/.+2w>>begin
—-
:/^part2/,/^part3/g/^chapter/.+2w>>begin|+t$