*usr_10.txt*	 Vim version 6.2.   : 2003 May 04

		  VIM -  

			  أ 


  4 ,      .  
,       
ߣ ,  ɣ,      , 
      .

|10.1|	   
|10.2|	 
|10.3|	  
|10.4|	 global
|10.5|	  
|10.6|	    
|10.7|	 
|10.8|	  
|10.9|	  

  : |usr_11.txt|    
 : |usr_09.txt|    
      : |usr_toc.txt|

==============================================================================
*10.1*	   

 "."   .   ,   
   ,   ?   
 .   ,     :

1.  "q{}"       {}.
          a  z.
2.   .
3.     q (  ).

        
"@{}".

,       . , 
   ,   :

	stdio.h ~
	fcntl.h ~
	unistd.h ~
	stdlib.h ~

     :

	#include "stdio.h" ~
	#include "fcntl.h" ~
	#include "unistd.h" ~
	#include "stdlib.h" ~

  ģ      .  
 :

	qa			     a.
	^			    .
	i#include "<Esc>	  #include "  
				    .
	$			    .
	a"<Esc>			    (")  
				    
	j			   .
	q			  .

    ,      
    "@a"  .
 "@a"    ,    
 .       >

	3@a


  

, ,     ,    
.            
"@a".    ,       "@@", 
   .       b 
  "@b",    "@@"   
 b.
           
".",    .  , "."   
 ,    "@a"     ,
  ,     ģ  . 
,  "."     .  
      ,   
 . ,     26 ,  
     26  .


 

,      --  ,    
  .        
,    .
   ,     n  .  
     "@n"   ,  
. , ,     ,    ,
     ?      
ɣ:

	G			   .
	o<Esc>			  .
	"np			    n.   
				         .
	{}	 ,    
				    ,     
				    .
	0			   .
	"ny$			     n.
	dd			  .

        "@n". (
     ,     
 ,     ,  
 ).


  

          .
       .
   ,          c. 
 ,        .
  .     >

	qC/word<Enter>q

  "qC"     ,     
c.  ,   ,     
    ,      
,  .

 ɣ      ,     
  . ,      
 a.      : >

	"aY

        >

	"AY

      .  a   
    ,     .

==============================================================================
*10.2*	 

 ":substitute" ()     
  .       : >

	:[]substitute///[]

	
    ""   ""   , 
  []. ,    ""  ""
   :  >

	:%substitute///
<
	:
	 :substitute      .  
	  ݣ  ":s".    
	 ݣ .

 "%"       .  
 ":s"    .    
   . 

 , ":substitute"     "" 
. ,    

	,   ,    ۣ  . ~



	,   ,    ۣ  . ~

     ,     
g (global, ).  >

	:%s///g

    

	,   ,    ۣ  . ~

 ,      ":s" : p (print,
)    ,   , c (confirm,
)      . 
 : >

	:%s///c
	
Vim ģ    ""   , 
 .   : >

	   (y/n/a/q/l/^E/^Y)?

         :

	y		 (yes), .
	n		 (no), .
	a		 (all);       
			     .
	q		 (quit);    .
	l		  (last);     .
	CTRL-E		     .
	CTRL-Y		     .


 ""        ,  , 
 ,     . ,  
   ""    ,    
 : >

	:s/^//

 ""  ""   ,    
   .     
     ,  "+": >

	:s+/+  +

==============================================================================
*10.3*	  

 ":substitute"    :     
.       : {},{}. :
>
	:1,5s///g

        1  5 .
    .

       ̣ : >

	:54s///

      ,    
.       ".",   
 . ,      ":write". 
     . ,  >

	:.write _

  _   .
        1.    
 "$". ,         : >

	:.,$s///
	
 "%",      ,     ݣ
   "1,$", "      ".


   

,           ""
  "",     .   ,   
  ""    .    
: >

	:?^?,/^/s===g

 ,     .  
"?^?"     ""     
. ,  ??     
. , "/^/"     "" 
  ң  . 
        ,     
   "=",       
   .


  

      :    
   "",     .     
,   ?  ģ  . 
            
: >

	//-1

 1     .    
   : >

	//+2

       . : >

	:.+3,$-5

  ,      ,   
         
   .


 

           
,   .
      ,       3. ,
  "mt"     ,  "mb" 
  .        
 (   ): >

	:'t,'b


   

     .   ģ ":"  
,    ,      : >

	:'<,'>

           
 ,    .

	:
	       ,  
	 CTRL-V    ,    ӣ
	     .    
	    Vim.

 ,  '<  '>  ,    
    .       
,       .  
  "'<"      
.  ,      : >

	:'>,$

          
 .


 

       ,    
   ":". ,  "5:",   : >

	:.,.+4

    ,   .  
    "." ( )  ".+4" (  
),     .

==============================================================================
*10.4*	 global

 ":global"       Vim. 
        
.    : >

	:[]global/{}/{}

     ":substitute",    ,
    ,   {}.

	:
	  ":global"   {}   
	,   .     
	   ":global" ,      
	  |:normal|.

,    "foobar"  "barfoo",   
   C++,    "//".  
: >

	:g+//+s/foobar/barfoo/g

ң,  .    ":g",  
  ":global",     ":s"   
":substitute".   , ޣ   "+", 
,       ,  , 
     .    , 
 "foobar"  barfoo".
      global     . ,  
    ,     ":substitute", 
      .
        ,   
  "//"        
 "//".

     ":substitute",    .  
   .

==============================================================================
*10.5*	  

  CTRL-V     . 
 ,       .

 "$"        
.  "$"   ,   
,           
,      ,  ,    ,
  ,   .     
   ,      
 ,   "j"    
,  "h"  .


 

 "I{}<Esc>"   {}     
 .        CTRL-V,
    .      
 I     .      
   .
     <Esc>   ,      ,
   . :

	include one~
	include two ~
	include three ~
	include four ~

    "o"  "one"   CTRL-V. , 
      "3j",     
 .  : >

	Imain.<Esc>

   :

	include main.one ~
	include main.two ~
	include main.three ~
	include main.four ~

     ,     ,  
     . ,   
,   ""      
 ,    :

	   ~
	 ~
	   ~
	
                   ^^^^^^^  

   "I <Esc>".   :

	    ~
	 ~
	    ~

      .
	           
  ,   ,    ,  "I" 
          
 . 

 "A"   ,  ģ    
  .
     "A"    :    
 "$"       .  
"A"   ģ       .
    , ģ , ģ "$A XXX<Esc>"   
:

	   XXX ~
	 XXX ~
	   XXX ~
	
       "$" 
 .        ,
      , ģ  
.


 

 "c"           .
      ,   
. 
    ӣ   ,   "c__<Esc>",  
  :

	  __ ~
	 ~
	  __ ~

      "I",     . ,
  ,        .

 "C"            
 ,          
.
         ģ  "C  <Esc>".
,       ""  ,  ӣ
   ,       
  :

	     ~
	 ~
	     ~

 ,     ,   .

 ,    :

	~	     (a -> A  A -> a)
	U	     (a -> A  A -> A)
	u	      (a -> a  A -> a)



 

        "r". 
     "rx":

	   ~
	 ~
	   ~
	

	:
	         , 
	   'virtualedit'   25.




 ">"        ,
 .        .
   ӣ     ">"   :

	       ~
	 ~
	       ~

     'shiftwidth'. ,  
  4   : >

	:set shiftwidth=4

 "<"          
.      .   
  ,   ,    
,  .


 

 "J"      ,   
.         ,
         . 
     (    
 'joinspaces').
     .    "J" :

	       ~

 "J"    .      
 "v"  "V"    .

   ,   ,    "gJ".

==============================================================================
*10.6*	    

,           . 
     ":read {-}". , 
  ,  ݣ    .
   ,       :

	, ! ~
	 diff,   . ~
	
	 . ~

      : >

	:read patch

    "patch"    .  :

	, ! ~
	 diff,   . ~
	2c2 ~
	<       for (i = 0; i <= length; ++i) ~
	---~
	>       for (i = 0; i < length; ++i) ~

	 . ~

 ":read"    ,     
     . , ":$r patch" 
  "patch"    .
     ,        
?      .  , , 
  ,        
      ,    :
>
	:0read patch

   "patch"      .


  

         ":write". 
      ,    ,
     : >

	:.,$write tempo

          "tempo".  
 ,      . Vim   
   .     ޣ  
,     !: >

	:.,$write! tempo

: !      ":write", 
.    !   -, 
    .


  

        ,     
 .          . 
    : >

	:.write collection

       : >

	:.write >>collection

">>"  Vim,       "collection",  
     .    
  .

==============================================================================
*10.7*	 

      ,    
 ,     .  
   ,    'textwidth'  
 : >

	:set textwidth=72

   ,    vimrc    
     ,      
 , , ,    .  
   'textwidth', : >

	:set textwidth

    ,     72
. ,         
,          .
Vim       . 
    Vim   ,   >

	gqap

   --  "gq",     
 "ap",   "".      
. 

	:
	 ,  ,   !

 "ap"        .
     ,    
   >

	gggqG

"gg"     , "gq"   , 
"G"      .

  ,       ޣ,  
 .     ,   
    "gqj",    
 ,   .      , 
       .    
,       .  
 "."      ,     
 ,   .

==============================================================================
*10.8*	  

,    ,      
,   ,      .  
  "gU". : >

			     gUw
<	        ---->       

 "gu"    : >

			     guw
<	 	    ---->       

       "g~",  
 ,        
 ,     .
            . 
 "d",  ң ,   : "dd". ,
"gugu"       . "gugu"  
 "guu", "gUgU"  "gUU"  "g~g~"  "g~~". : >
	                              
				     g~~
<	      ---->      ~

==============================================================================
*10.9*	  

 Vim       ,   
  ӣ.   ,   ,  
      . 
    "!{}{}" ң     
    .  ,   
 ,  {},     
,  {}.     .
          UNIX,     
.    .  sort  . 
   >

	sort <.txt >.txt

   .txt      
.txt. (    UNIX,    Microsoft Windows.)
         Vim. ,    
    .       ģ  >
	
	!5G

"!"  Vim,     .   ģ
 ,         
 .  "5G"        
5,    Vim ,      1-  5-. 
     -,       
     !.     
 ,    "sort".    
 : >

	!5Gsort<Enter>

   sort      . 
  ,       .

	line 55			      line 11
	line 33			      line 22
	line 11        -->	      line 33
	line 22			      line 44
	line 44			      line 55
	last line		      last line

 "!!"   -  .   Unix
 "date"     . "!!date<Enter>"  
   "date",       
   . 


    ?

 ,       , 
Vim   ,    .      
 ,     :

	'shell'		   ,  Vim 
			     .
	'shellcmdflag'	,    
			    
	'shellquote'	     
	'shellxquote'	      
			    
	'shelltype'	  (  Amiga)
	'shellslash'	     ( 
			   MS-Windows   )
	'shellredir'	      

 Unix    ,       
: sh-  csh-. Vim   'shell' 
       ţ , 
  ,     'shell'  "csh".
    MS-Windows, ,       
      .  
      .


  

          ,
 :

 Unix: >
	:read !ls
 MS-Windows: >
	:read !dir

  "ls"  "dir"    
  ,  .    ,  
,   "!"   ,  
.
      ,      
 ,   Vim   : >

	:0read !date -u

       UTC     ( 
     date     "-u".) :
      "!!date",   
 ,   ":read !date",   .


  

 Unix "wc"  .      ,
: >

	:write !wc

  ӣ    write,      "!" 
   .       
    .     :

	4      47     249 ~

 "wc"   .  ,      4 ,
47   249 . 

 ,    >

	:write! wc

      "wc"      
.     !


 

      ,    
   . Vim     ,  
    ,      ,  
   .  Vim  , : >

	CTRL-L

==============================================================================

 : |usr_11.txt|    
 : . |___|  

vim:tw=78:ts=8:ft=help:norl:
