*usr_05.txt*	 Vim version 6.2.   : 2003 Aug 13

		  VIM -  

				  


Vim     .     
Vim    ,     
     .

|05.1|	 vimrc
|05.2|	  vimrc  
|05.3|	  
|05.4|	  
|05.5|	  
|05.6|	 
|05.7|	  

  : |usr_06.txt|    
 : |usr_04.txt|    
      : |usr_toc.txt|

==============================================================================
*05.1*	 vimrc                              *vimrc-intro* *vimrc-*

       ,   . 
 Vim        , 
      vimrc. Vim    
.

   ,     vimrc,   
: >

	:scriptnames

        ".vimrc"  "_vimrc"  
     .
        vimrc,  . |vimrc|,  ,  
.   ,    ":version"    
"  vimrc",   Vim.

 Unix    : >

	~/.vimrc

  MS-DOS  MS-Windows      
: >

	$HOME\_vimrc
	$VIM\_vimrc

 vimrc    ,   . 
       . ,   ,
 Vim    ޣ  'incsearch',    
 vimrc  : >

	set incsearch

 ,     ,    Vim  
 .         Vim.

       .   
   Vim  : |usr_41.txt|.

==============================================================================
*05.2*	  vimrc  		   *vimrc_example.vim*
						          *__vimrc*

    ,    vimrc, ޣ   Vim
     Vim    (.
||).     :

	$VIMRUNTIME/vimrc_example.vim ~

           . 
      ,    .
        ,   
  ":help". 

>
        set nocompatible


     ,  ,   
 Vim   ,      Vi.   
    'compatible'   .

>
	set backspace=indent,eol,start

        <BS>   
 .      Vim 
   ,     ,   
̣    . 

>
	set autoindent

   Vim,       
  .  ,      
  ,     . ,  
<Enter>        "o"   
.
>

	if has("vms")
	  set nobackup
	else
	  set backup
	endif

  Vim      ,  
 VMS,      . 
      ,   ,   "~". .
|07.4|.
>

	set history=50

   50   50   .   
    ,     .
>

	set ruler

         
  Vim.

>
	set showcmd

 ۣ       Vim,  
. ,   "2f", Vim   , 
    "2f".   "w"   "2fw"
 "2f"   .

	+-------------------------------------------------+
	|   Vim				  |
	|~						  |
	|~						  |
	|-- . --			2f     43,8   17% |
	+-------------------------------------------------+
	 ^^^^^^^^^^^		      ^^^^^^^^ ^^^^^^^^^^
	  'showmode'		     'showcmd'	'ruler'

>
	set incsearch

       .
>
	map Q gq

  .       . 
  ,   "Q"   
  "gq".      Vim 5.0.   
 "Q"   Ex,      .

>
	vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc>

  ,   .       
,   ţ   : "p"   
       .  ,
     ,    -
 ,         
.
>
	if &t_Co > 2 || has("gui_running")
	  syntax on
	  set hlsearch
	endif

      ,   
.  'hlsearch'  Vim   
 .  "if"       
̣ .      |usr_41.txt|.

							     *vimrc-_*
							      *vimrc-filetype* 
>
	filetype plugin indent on
	
     :

1.   
       Vim      
    .    "main.c",  Vim   
   ".c",      "c".    , 
    "#!/bin/sh",  Vim ,      "sh".
            
   ,   .
   . |_|.

2.     ̣ 
          . ,
       "c"     'cindent'
       .  
            . 
            , .
   |___|.

3.    
            
    .  Vim      
      . . |:filetype-indent-on|  'indentexpr'.

>
	autocmd FileType text setlocal textwidth=78

   Vim  ,     78
,  ,      .  
  . "autocmd FileType text"  ,
,      ,   
̣  " ". "setlocal textwidth=78"  
'textwidth'  78   .
>

	autocmd BufReadPost *
	    \ if line("'\"") > 0 && line("'\"") <= line("$") |
	    \   exe "normal g`\"" |
	    \ endif

ݣ  .        .
    ţ ,     '" 
    .       
      ,    
 . . |_|.     
  Vim,     .

==============================================================================
*05.3*	  

      Vim   .
,        
   , ..    ""  
"{}".    :map    Vim   
    F5.    : >

	:map <F5> i{<Esc>ea}<Esc>
<
	:
	       <F5> , ԣ 
	ң   . <Esc>     ,
	    <Esc>.      
	!

 ң,  ,  :
    <F5>	  F5    
	          .
		
    i{<Esc>	  {. <Esc>   .
    
    e		   .
    
    a}<Esc>	 }   .

 ,     ":map", ӣ    
,      ,     
    F5.

        
,      . , ,   , 
    Vim     
,     .
     ,     , 
  .      
,    - . ,   ,
 "\p"     ,  "\c"   
. :
>
	:map \p i(<Esc>ea)<Esc>
	:map \c i{<Esc>ea}<Esc>

   \  p     ,  Vim
,      .

 ":map"      ,  
  .       |40.1|.

==============================================================================
*05.4*	  	        *add-plugin* *plugin* **
			                                   *_*

 Vim     ޣ  . 
  Vim,      Vim.
         plugin.
{ ,  Vim     |+eval|}

   :

	  :	    
      :	   ̣  

    ,      
|___|.

					                 *_*
   			        *standard-plugin* *_*

  Vim     .  
  ,    
 ,       , 
    .     
: |__|.   |_|.

				*add-global-plugin* *__*
       ,  
    Vim.      
:

1.   .
2.     .


     ?

   ?

-      Vim.   
  $VIMRUNTIME/macros   
-     ,  : http://vim.sf.net.
-       || Vim.
-    . . |__|.


  

   ,     
.      :

			   ~
	Unix		~/.vim/plugin/
	PC  OS/2	$HOME/vimfiles/plugin or $VIM/vimfiles/plugin
	Amiga		s:vimfiles/plugin
	Macintosh	$VIM:vimfiles:plugin
	Mac OS X	~/.vim/plugin/
	RISC-OS		Choices:vimfiles.plugin

  Unix (,        ):
>
	mkdir ~/.vim
	mkdir ~/.vim/plugin
	cp /usr/local/share/vim/vim60/macros/justify.vim ~/.vim/plugin

  ӣ!     , ̣   
     .


  	 *add-filetype-plugin* *ftplugins* *__*
				                *___*

Vim        ,  
     >

	filetype plugin on

  ӣ,    . . |vimrc-_|.

      - ̣  ,   
  ,       .  
:

1.   .
2.  ţ   .


    ?

 ,    . ,     ,
    .   $VIMRUNTIME/macros  , 
     $VIMRUNTIME/ftplugin.


           *ftplugin-name* *__-*

         .
   ,       , 
 "ftplugin". ,        "stuff" 
   Unix.         ftplugin:
>
	mv thefile ~/.vim/ftplugin/stuff.vim

    ,          
"stuff". ,       , 
  .  ӣ  ,      
 : >
	
	mv thefile ~/.vim/ftplugin/stuff_too.vim

 ޣ       
  ,     . 
"otherstuff.vim"   ,      
  "otherstuff".

 MS-DOS     .    
  ,        
.        : >

	mkdir $VIM/vimfiles/ftplugin/fortran
	copy thefile $VIM/vimfiles/ftplugin/fortran/too.vim

  ,      : >
	
	ftplugin/<filetype>.vim
	ftplugin/<filetype>_<name>.vim
	ftplugin/<filetype>/<name>.vim

  "<name>"    .
,    "stuff"  Unix: >

	~/.vim/ftplugin/stuff.vim
	~/.vim/ftplugin/stuff_def.vim
	~/.vim/ftplugin/stuff/header.vim

  <filetype>    ,    
 .       , 
 . <name>        
     .  :   
 ".vim".

 :
|___|	        ,
			      ,   
			    .
|_|	      Vim.
|____|	
			 ,    
			    .
|__|	     
|__|	      
			      ,  ,   
			    .
|__|	     .

==============================================================================
				                    *__* 
							   *matchit-*
*05.5*	  	    *add-local-help* *matchit-install*

  ,  ,   ,   
 .  ,     ,
      .
   ͣ, ,  "matchit.vim" (    Vim).
     "%"     
     HTML, if/else/endif   Vim 
..,     , ,  ,  
,      ޣ  . 
        : "matchit.txt".   
   .        Vim,
   $VIMRUNTIME. (     
,      "mkdir".) >

	:!mkdir ~/.vim
	:!mkdir ~/.vim/plugin
	:!cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin

   "doc"    ,   'runtimepath'.
>
	:!mkdir ~/.vim/doc

    : >

	:!cp $VIMRUNTIME/macros/matchit.txt ~/.vim/doc

 ,  :    ,  
          |:helptags|.  >

	:helptags ~/.vim/doc

    
>
	:help g%

  "g%"   ,     .  
ң >
	
	:help local-additions

      .   
     .

     . |_|.
   
==============================================================================
*05.6*	 

      : ||. 
     >

	:options

       .   
 .       .   
 ,    ,     
  <Enter>.   <Enter>     
.     CTRL-O.

      . ,    
" ",       >

	set wrap        nowrap

  ͣ <Enter>,     >

	set nowrap      wrap

 ,     .

   'wrap'     . 
       <Enter>     
   'wrap'. 

  ,      , 
      .  ,  
  ,  <Enter>. ,    
    >

	set so=0

        "$".    
 "r5".   <Enter>,      
.  ,  ,    ,  
   ,      .   
  'scrolloff',       , 
 .

==============================================================================
*05.7*	  

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

	:help 'wrap'

  -     ,   
       (&)   .
: >

	:set iskeyword&

  

Vim    ,       .
   ,    ,   
  .       
,     .  
 : >

	:set nowrap

Vim     ,     ,
    .   10    ,
  >

	:set sidescroll=10
	
      ,    .


  

        . 
      'whichwrap'.  
      : >
    
	:set whichwrap=b,s

    <BS>,      
,      .  <Space> ()
       .

 ,    <Left>  <Right>    
 ,  : >
	
	:set whichwrap=b,s,<,>

,       .   <Left> 
<Right>        ,  : >

	:set whichwrap=b,s,<,>,[,]

     , . 'whichwrap'.


 

   ,  ,  .    
 : >

	:set list

   Tab    ^I.  ,   
 $,           . 
    ,      ,     
  .  ,  ,   
 , Vim       
  .   'listchars': >

	:set listchars=tab:>-,trail:-

        ">---",    
   "-".  , ?


 

 'iskeyword' ,      : >

	:set iskeyword
<	  iskeyword=@,48-57,_,192-255 

 "@"    , "48-57"  
ASCII  48  57 (..   0  9), "192-255"   .
            
"",    "w"   ,  "-" 
.    : >

	:set iskeyword+=-
	:set iskeyword
<	  iskeyword=@,48-57,_,192-255,-

     ,  ,  Vim   
.
     ,  "-=". ,   
ޣ: >

	:set iskeyword-=_
	:set iskeyword
<	  iskeyword=@,48-57,192-255,-

     .


  

  Vim         .
   ,    ,    
  ,    ,   
    <Enter>.
       'cmdheight',    
,    . : >

	:set cmdheight=3

 , ,        ,
     .

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

 : |usr_06.txt|    
 : . |___|  

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