*usr_40.txt*	 Vim version 6.2.   : 2002 Oct 29

		  VIM -  

			      


Vim     .   
      , 
      
 .

|40.1|	 
|40.2|	      
|40.3|	

  : |usr_41.txt|    Vim
 : |usr_31.txt|	   
      : |usr_toc.txt|

==============================================================================
*40.1*	 

       |05.3|. 
   ,      
    .    ,
,  ,   . 
          
  -       .
  ,   <F1>   -
   Vim,      
.  : >

	:map <F2> Go: <Esc>:read !date<CR>kJ

     .    
     "G",      
"o",      . ,   ": " 
  <Esc>     .
       <>   .  
    .    , 
   .      
         . 
    ":"      .  ":read
!date"     "date"     
.    ":read"   <CR>.
        :

	:  ~
	, 15  2001 . 12:54:34 (MSK) ~

  "kJ"         
 .
    ,     ,   |-_|.


   

 ":map"       .  
     .  ":imap" 
   .    , , 
     : >

	:imap <F2> <CR>: <Esc>:read !date<CR>kJ

 ,     ģ    <F2> 
 , ӣ     .    
<F2>      ,     
          .
    ,        
 ,      .   
  ,      "a".

        ,  
̣      :

	:map		,     
	:vmap		
	:nmap		
	:omap		 
	:map!		   
	:imap		
	:cmap		 

    ,      
-,  "d"  "y".    , 
         
  .  ,    "dw", 
"w"     .

,      <F7> ,   d<F7>
     C (..     {}).
 ,  y<F7>     
 .       
    <F7>.      
: >

	:omap <F7> a{

     "a{"   <F7>   
.       ,   { 
  .


 

    ,   ":map" 
.       ̣
,    .    :

	   _g		 :call MyGrep(1)<CR> ~
	v  <F2>		 :s/^/> /<CR>:noh<CR>`` ~
	n  <F2>		 :.,$s/^/> /<CR>:noh<CR>`` ~
	   <xHome>	 <Home>
	   <xEnd>	 <End>


     ,      
.    "n",   -- "i",  ..
 ̣    ":map",    
 ,     ,   . 
           ,   
       
  <> ( ,    ).  <Esc>
    ,   ,    
 .     ,  
      . 


   

       . ,
  <F2>    : >

	:map <F2> G<F3>
	:imap <F2> <Esc><F3>
	:map <F3>  o: <Esc>:read !date<CR>kJ

   <F2>        ģ 
,       <F3>.    <F2> 
    <Esc>       <F3>.
  <F3>  ,     . 

,       Ex   
 "Q"   ,       Vim. 
 ģ  : >

	:map Q gq

   ,   ӣ     Ex,
  "gQ"  Q: >

	:map gQ Q

,     ̣ !   
 "gQ",      "Q", ,  "Q"
  "gq",    "gQ"    "gq", 
        Ex.
        ,  
  ":noremap": >

	:noremap gQ Q

 Vim ,  "Q"       
.       :

	:noremap	,     
	:vnoremap	
	:nnoremap	
	:onoremap	 
	:noremap!	   
	:inoremap	
	:cnoremap	 


 

    ,     . 
     -  
 .
   ,       ,    
    .     ,
    "vim *.txt". ,    
.   : >

	:map ,, :s/5.1/5.2/<CR>:wnext<CR>,,

  ",,".    , Σ  .
"5.1"        "5.2".  
       . 
  ",,",        
,  ..
        ,      . 
     ,      ģ
  "5.1".         
 "5.1"   ,    ",,".  
    ,     
":wnext",  ģ      
. 
           , 
     .   
     CTRL-C (CTRL-Break  MS-Windows).


 

     ":unmap"    
   :

	:unmap		,     
	:vunmap		
	:nunmap		
	:ounmap		 
	:unmap!		   
	:iunmap		
	:cunmap		 

   ,        
 ,      .  
  ɣ:      ң
 ,    ţ   :  >

	:map <C-A> /---><CR>
	:vunmap <C-A>

 ,   "<C-A>"     
CTRL-A.

        
|:mapclear|.         
 .      , .. ţ
 !


 

 ":map"      . 
     |.    ,  
|      .  
   <Bar>. : >
>
	:map <F8> :write <Bar> !checkin %<CR>

       ":unmap"   ,   
      .    : >
>
	:unmap a | unmap b
	:unmap a| unmap b

         "a "  
 .

        <Space>: >

	:map <Space> W

       ң  
̣  .

    ,   " 
 .


  

      . 
    .     
 .       
 ,       .
       ,  ,   ,
    .     
, ģ       
.   ,   ,    
   ,    ģ   . 
  'showcmd',  ģ     
 Vim.
     ,     
. ,     : >

	:imap aa foo
	:imap aaa bar

  ,   "aa" Vim   ,    
,       .  
  "a",        ( 
  "bar").    ,  , ,  
    ("foo"),    .


 ...

 <script>     ,  
 . . |:map-<script>|.

 <buffer>     ,  
̣ . . |:map-<buffer>|.

 <unique>    ,   
     ,     
.         
 ̣ . . |:map-<unique>|.

    ,  ţ  <Nop> ( ). 
 ģ  ,   <F7>     : >

	:map <F7> <Nop>| map! <F7> <Nop>

 <Nop>    .

==============================================================================
*40.2*	      

 Vim    .  
    ,      
. 
        ":command". : >

	:command DeleteFirst 1delete

      ":DeleteFirst" Vim  
 ":1delete",       .

	:
	, ̣ ,    
	.        ":X", ":Next" 
	":Print".  ޣ  !  
	,   .

    ,  : >

	:command

   ,    ,  
.       
 ,      
̣ .       
  .


 

, ̣ ,   . 
       -nargs.  
:DeleteFirst   ,  ţ      : >

	:command -nargs=0 DeleteFirst 1delete

,   0   ,   "-nargs=0"
  .    -nargs:

	-nargs=0	  
	-nargs=1	 
	-nargs=*	  
	-nargs=?	0  1 
	-nargs=+	1   


 

      <args>. : >

	:command -nargs=+ Say :echo "<args>"

  

	:Say , 

Vim    ", ". ,    
  ,     . : >

	:Say   ""

         
,  "<q-args>": >

	:command -nargs=+ Say :echo <q-args>

  ":Say"    : >

	:echo "  \"\""

 <f-args>    ,   <args>,   ,
      . : 
>
	:command -nargs=* DoIt :call AFunction(<f-args>)
	:DoIt a b c

   : >

	:call AFunction("a", "b", "c")


 

       . 
  ,    -range. 
 :

	-range		  ;   -- 
			   
	-range=%	  ;   --  
	-range={}	      , 
			      {}

  ,     <line1>  <line2> 
       . ,
    SaveIt,   
    "save_file": >

	:command -range=% SaveIt :<line1>,<line2>write! save_file


 

         :

	-count={}		   
				-, ţ   
				 {}.   
				     
				<count>.
	-bang			   !.   !,  
				<bang>    !.
	-register		     . (
				   .)
				    
				 <reg> ( <register>).
	-complete={}		    
				.    . 
				|:command-|.
	-bar			    |  
				,  "  .
	-buffer			     .

 ,    <lt>     <.
       
  <>.


  

       !: >

	:command -nargs=+ Say :echo "<args>"
	:command! -nargs=+ Say :echo <q-args>

     ":delcommand".  
  ,     . : >

	:delcommand SaveIt

   ̣  : >

	:comclear

 ,      !

  ,   .  :
|_|.

==============================================================================
*40.3*	

   ,    
 ̣ ,      , 
  .    , ,  Vim
  .      |gzip|.
    --   .     
   ,     
. ,        . 

,        , 
   ,       . 
   : >

	:function DateInsert()
	:  $delete
	:  read !date
	:endfunction

     ,     .
  ,  : >

	:autocmd FileWritePre *  call DateInsert()

"FileWritePre"    ,    
:       . "*" 
   ,     ,  
     .
      ,  Vim    
        
FileWritePre  ,        ":write".
     :autocmd : >

	:autocmd [] {} {__} [nested] {}

  []    
 (   ).  {}  
 ,      .
   {__}   ,     .
,  "*.txt"     
,    ".txt".   [nested]
    (. ), , ,
 {},   .




      BufReadPost.    
  .      
  . ,  ,   "*.gsm" 
     GNU.     
  ,   : >

	:autocmd BufReadPost *.gsm  set filetype=asm

 Vim     ,     
 'filetype' .     Filetype. 
     ̣  
 ̣  . ,   
,    : >

	:autocmd Filetype text  source ~/.vim/abbrevs.vim

    ,    Vim   
  -: >

	:autocmd BufNewFile *.[ch]  0read ~/skeletons/skel.c

     |-|.




 {__}     ̣
   . , "*.c,*.h"   ,
    ".c"  ".h".
       -.    
 :

	*		     
	?		    
	[abc]		  a, b  c
	.		 
	a{b,c}		 "ab"  "ac"

       (/),  Vim  
  .      
    . , "*.txt" 
"/home/biep/readme.txt".      "/home/biep/*", 
 "home/foo/*.txt".
       Vim     
    ( "/home/biep/readme.txt"),   
 ("biep/readme.txt").

	:
	   ,     
	       ,   MS-Windows,
	        
	 .       , 
	      ,   
	       .




      ,     
 !   {}. : >

	:autocmd! FileWritePre *

         "FileWritePre",
   "*"    .




   ̣    , 
: >

	:autocmd

    ,   
  .     ,
    ,  / . , 
      BufNewFile: >

	:autocmd BufNewFile

         "*.c": >

	:autocmd * *.c

 "*"      . 
     cprograms: >

	:autocmd cprograms




{}       
.    , ,   
,    .
      ,     ,
  ":augroup".   ,  
,        C: >

	:augroup cprograms
	:  autocmd BufReadPost *.c,*.h :set sw=4 sts=4
	:  autocmd BufReadPost *.cpp   :set sw=3 sts=3
	:augroup END

   >

	:autocmd cprograms BufReadPost *.c,*.h :set sw=4 sts=4
	:autocmd cprograms BufReadPost *.cpp   :set sw=3 sts=3

      "cprograms": >

	:autocmd! cprograms


 

 ,      -
,      .    
  FileChangedShell,        
, , ,      
.    ӣ  ,   
"nested": >

	:autocmd FileChangedShell * nested  edit


 

       ,    
 .    ,    
. : >

	:autocmd BufReadPost *.new  execute "doautocmd BufReadPost " . expand("<afile>:r")

    ,    
       ,  
".new".  ":execute"      ,
   .      
"tryout.c.new",    : >

	:doautocmd BufReadPost tryout.c

 expand()   "<afile>",    
,    ,     
   ":r".

":doautocmd"    .  ":doautoall"  
,   ":doautocmd",   ,     
.


   

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

	:autocmd BufReadPost *.log normal G

         .log  
  .
     ":normal"   .  ,
,        
,    .      
   "i",    ,     <Esc>
    .     "/"  
  ,      <CR>,   
  . 
    ":normal"   ,    ţ 
 -. ,       |
   .    , 
 ":normal"   ":execute".    
   . : >

	:autocmd BufReadPost *.chg execute "normal ONew entry:\<Esc>" |
		\ 1read !date

        
     .    
 Vim,      .

  ,      , 
       ,   
ģ   . .   
|_|.


 

  ,  , ,    
    ̣ .  'eventignore'
   ,   . ,
         
      : >

	:set eventignore=WinEnter,WinLeave

   ,  : >

	:set eventignore=all

   ,   'eventignore': >

	:set eventignore=

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

 : |usr_41.txt|    Vim
 : . |___|  

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