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


		        VIM -  


  ݣ      C    .

1.      C	|C-|
2.  		|-|
     	           

==============================================================================
1.      C	             *C-indenting* *C-*

       C   
|30.2|  .

Vim        
,    C.     
    -  .  
  . |-|.

:        , 
Vim   ޣ  |+smartindent|  |+cindent|.

        :

'autoindent'	   .
'smartindent'	 ,   'autoindent',     
		   C    
		 ,   .
'cindent'	       
		 C,   .  
		        C.
'indentexpr'	    :  
		     
		.      ,   
		       .
		. |-|.

        'cindent'.

:     'cindent'    
. Vim  C-:       .

     C   :

'cindent'	    
		    C.
'cinkeys'	 ,      
		 .
'cinoptions'	     
		 .
'cinwords'	  ,    
		 .

  'lisp' ,    - 'equalprg'  , 
 "="      
 Vim,    .

 ,   ,   'cindent'  
        C    
 ,    ||.

					  *cinkeys-* *indentkeys-*
					  *cinkeys-format* *indentkeys-format*
  'cinkeys'  ,   
   Vim     ̣    
̣ .        C.  
'indentexpr'  ,    'cinkeys'  
'indentkeys'.   'cinkeys'  'indentkeys' .

     "0{,0},0),:,0#,!^F,o,O,e", 
    :

	"0{"	  '{'      
	"0}"	  '}'      
	"0)"	  ')'      
	":"	  ':'      case 
	"0#"	  '#'      
	"!^F"	  CTRL-F (   )
	"o"	  <CR>        "o"
		(   !)
	"O"	   "O" (   !)
	"e"	   'e'  "else"   

,    :

!	   '!',  Vim     , 
	     .  
	      .
	    CTRL-F.  ,  
	      CTRL-I,  CTRL-I  
	 ,   <Tab>.
	
*	   '*',     Vim 
	 .     'cinkeys' 
	 "*<Return>",  Vim   
	  ,    .
	
0	   0,    '!'  '*', 
	Vim        ,
	    ,    .  0
	  "=",  Vim     
	   ,     .

     '!',  '*',  Vim   
   . , ';'    , 
  ';'.

 :

<>	     . : "<Up>",
	"<Ins>" (. |_|).

^	,    ^,   .
	: "^F"   ,   CTRL-F.

o	       
	"o"        (,  
	<Enter>   ).

O	       
	"O".

e	    ,   
	"else"    "e".

:	       ':'  
	  case.     
	 ":"  "::"  C++.   
	   ":"   ,  "<:>".

=	      "". 
	, ""        . ,
	"=end"        "d" 
	 "endif"  "endwhile",      "bend".  ,
	  ,    
	 ,     "". "0="
	     ,    
	   .

=~	 =,   ޣ  .

        
'o', 'O', 'e', '0', '<', '>', '*', ':'  '!',   "<o>", "<O>",
"<e>", "<0>", "<<>", "<>>", "<*>", "<:>"  "<!>"   
.

     emacs,     
 Enter,    Tab,     : >

	:set cinkeys=0{,0},:,0#,!<Tab>,!^F

        'autoindent'.

:        ,  Vim 
  'cindent'   .    Vim 
     ,    
     <BS>, <Tab>  <Space>,    
CTRL-T  CTRL-D.

				     *cinoptions-values* *cinoptions-*
 'cinoptions'    ,  
 Vim.  ,   , "N"   ,
      .    
's',  Vim       'shiftwidth': "1s" 
 'shiftwidth', "2s"    'shiftwidth'  .. 
       : "-0.5s"
    'shiftwidth'.  , 
 , ,    'shiftwidth'  4.

	>N     ,   " ".
	        ,    
	      (,    "if",   
	       ..).  : ,   'shiftwidth'.

		cino=		    cino=>2		cino=>2s >

		  if (cond)	      if (cond)		  if (cond)
		  {		      {			  {
		      foo;		foo;			  foo;
		  }		      }			  }
<
	eN     N      , 
	            ( , 
	         ).    
	      ,  ,    '{'  
	      ,   ,    '{' 
	       .  : 0.

		cino=		    cino=e2		cino=e-2 >
		  if (cond) {	      if (cond) {	  if (cond) {
		      foo;		    foo;	    foo;
		  }		      }			  }
		  else		      else		  else
		  {		      {			  {
		      bar;		  bar;		      bar;
		  }		      }			  }
<
	nN     N       "if",
	      "while"  ..,       .
	       ,  ,  ,   
	      '{'  ,   ,   '{' .
	       : 0.

		cino=		    cino=n2		cino=n-2 >
		  if (cond)	      if (cond)		  if (cond)
		      foo;		    foo;	    foo;
		  else		      else		  else
		  {		      {			  {
		      bar;		  bar;		      bar;
		  }		      }			  }
<
	fN           
	         N.      ,
	               
	       . ,      ,
	        ţ.  : 0.

		cino=		    cino=f.5s		cino=f1s >
		  func()	      func()		  func()
		  {			{		      {
		      int foo;		    int foo;		  int foo;
<
	{N         N  
	       .
	           ,  
	         .  : 0.

		cino=		    cino={.5s		cino={1s >
		  if (cond)	      if (cond)		  if (cond)
		  {			{		      {
		      foo;		  foo;		      foo;
<
	}N         N  
	        .  : 0.

		cino=		    cino={2,}-0.5s	cino=}2 >
		  if (cond)	      if (cond)		  if (cond)
		  {			{		  {
		      foo;		  foo;		      foo;
		  }		      }			    }
<
	^N     N      , 
	            0. 
	              
	       ( ,    
	      ).  : 0.

		cino=		    cino=^-2		cino=^-s >
		  func()	      func()		  func()
		  {		      {			  {
		      if (cond)		if (cond)	  if (cond)
		      {			{		  {
			  a = b;	    a = b;	      a = b;
		      }			}		  }
		  }		      }			  }
<
	:N      case  N    switch(). 
	       :  'shiftwidth'.

		cino=		    cino=:0 >
		  switch (x)	      switch(x)
		  {		      {
		      case 1:	      case 1:
			  a = b;	  a = b;
		      default:	      default:
		  }		      }
<
	N      ,    case,  N
	         .  :  'shiftwidth'.

		cino=		    cino==10 >
		   case 11:		case 11:  a = a + 1;
		       a = a + 1;		  b = b + 1;
<
	lN     N != 0,  Vim      case
	       ,   ţ.

		cino=			    cino=l1 >
		    switch (a) {	      switch (a) {
			case 1: {		  case 1: {
				    break;	      break;
				}		  }
<
	gN        C++  N  
	       ,    .  : 
	      'shiftwidth'.
	          "public:", "protected:" 
	      "private:".

		cino=		    cino=g0 >
		  {		      {
		      public:	      public:
			  a = b;	  a = b;
		      private:	      private:
		  }		      }
<
	hN     ,    
	       C++  N    .  :
	       'shiftwidth'.

		cino=		    cino=h10 >
		   public:		public:   a = a + 1;
		       a = a + 1;		  b = b + 1;
<
	pN         K&R    N
	        .  : 'shiftwidth'.

		cino=		    cino=p0		cino=p2s >
		  func(a, b)	      func(a, b)	  func(a, b)
		      int a;	      int a;			  int a;
		      char b;	      char b;			  char b;
<
	tN           N
	        .  : 'shiftwidth'.

		cino=		    cino=t0		cino=t7 >
		      int	      int			 int
		  func()	      func()		  func()
<
	+N       (,   
	      )  N  .  :
	      'shiftwidth'.

		cino=			  cino=+10 >
		  a = b + 9 *		    a = b + 9 *
		      c;			      c;
<
	cN         ,  
	             ,  
	      N     ( : 3). . 
	      |-|.

		cino=			  cino=c5 >
		  /*			    /*
		     .		         .
		   */			     */
<
	CN     N   0,      
	      ,     c (. ),  
	          -  . 
	       : 0.

		cino=c0			  cino=c0,C1 >
		  /********		    /********
		    .		    .
		  ********/		    ********/
		  
<	      (    
	      ":set comments& comments-=s1:/* comments^=s0:/*")

	/N         N . 
	       : 0.

		cino=			  cino=/4 >
		  a = b;		    a = b;
		  /*  */		/*  */
		  c = d;		    c = d;
<
	(N           N  
	          .   
	         'shiftwidth' .  N 
	       0      
	        ,     
	         .  :  
	      'shiftwidth' * 2.

		cino=			  cino=(0 >
		  if (c1 && (c2 ||	    if (c1 && (c2 ||
			      c3))		       c3))
		      foo;			foo;
		  if (c1 &&		    if (c1 &&
			  (c2 || c3))		(c2 || c3))
		     {			       {
<
	uN     ,   (N,     .  :
	        'shiftwidth'.

		cino=			  cino=u2 >
		  if (c123456789	    if (c123456789
			  && (c22345		    && (c22345
			      || c3))		      || c3))
<
	UN     N   0,   ,   (  u,
	        ,     
	         .  : 0.

		cino= or cino=(s	  cino=(s,U1 >
		  c = c1 &&		    c = c1 &&
		      (				(
		       c2 ||			    c2 ||
		       c3			    c3
		      ) && c4;			) && c4;
<
	wN         N   0   
	      , , "(0"  "u0",  
	       "U0"     
	         ,    ,
	          ,   
	        .  : 0.

		cino=(0			  cino=(0,w1 >
		  if (   c1		    if (   c1
			 && (   c2		&& (   c2
				|| c3))		    || c3))
		      foo;			foo;
<
	mN     N   ,   ,  
	             
	       .  : 0.

		cino=(s			  cino=(s,m1 >
		  c = c1 && (		    c = c1 && (
		      c2 ||			c2 ||
		      c3			c3
		      ) && c4;		    ) && c4;
		  if (			    if (
		      c1 && c2			c1 && c2
		     )			    )
		      foo;			foo;
<
			     *java-cinoptions* *java-indenting* *java-*
	jN           Java .
	       'N'     ,    
	       0 (, 'j1'). 'j1' ,  , 
	           : >

		object.add(new ChangeListener() {
		    public void stateChanged(ChangeEvent e) {
			do_something();
		    }
		});
<
	)N    Vim     ,   N . 
	        ,    . 
	      : 20 .
	
	*N    Vim     ,   N . 
	        ,    
	      .  : 30 .


  ,   : >
	
	cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,gs,hs,ps,ts,+s,c3,C0,(2s,us,
		   \U0,w0,m0,j0,)20,*30

Vim     1   :

-    '#' ( ),    'cinkeys'
    '#'.

-     (,    ':',  "case" 
  "default".

-       ,   
   .

==============================================================================
                                                           *-*
2.     	           *indent-expression* 


       
 |30.3|  .

         ,
      'indentexpr'.   
    'indentkeys'.    
 $VIMRUNTIME/indent.


        ~

FORTRAN				            *fortran-indent* *fortran-*

   if, select case  where. , 
         , 
  Fortran'    ,   ,   
Fortran'   ֣ ,    
    .        
      
.       
   .   |fortran-|.

 do ~

 ,     do   .  do
 Fortran'   ,   
           .
        
 .   ,    do  
    ,     
 ,  Tidy (http://www.unb.ca/chem/ajit/f_tidy.htm).
  do/continue     
 ,   continue   
     do. ,  Tidy, 
  do/continue   do/enddo.    do/enddo
   .    
   do/enddo,     ,
    fortran_do_enddo   .vimrc.

: >

   let fortran_do_enddo=1

      do  .    
  .f90   do/enndo,    
   ţ   . : >

  au! BufRead,BufNewFile *.f90 let b:fortran_do_enddo=1

     do    .f90,  
       Fortran'   ,  
.for.


VERILOG				            *verilog-indent* *verilog-*

      ,   if,
for, case, always, initial, function, specify, begin  ..  
  , ..   ,   
.         
   .vimrc: >

  let b:verilog_indent_modules = 1

         .  ,
   ,    : >

  :unlet b:verilog_indent_modules

      Verilog,  
  : >

  au BufReadPost * if exists("b:current_syntax")
  au BufReadPost *   if b:current_syntax == "verilog"
  au BufReadPost *     let b:verilog_indent_modules = 1
  au BufReadPost *   endif
  au BufReadPost * endif

 ,   b:verilog_indent_width  
  ( :   'shiftwidth'): >

  let b:verilog_indent_width = 4
  let b:verilog_indent_width = &sw * 2

        : >

  let b:verilog_indent_verbose = 1

 ,      ":set cmdheight=2", 
    .

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