robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqMerge pull request #36504 from zeertzjq/vim-c8eeda9cf347110c1

master
42.6 KiB1268 linesraw
1*indent.txt*    Nvim
2
3
4		  VIM REFERENCE MANUAL	  by Bram Moolenaar
5
6
7This file is about indenting C programs and other files.
8
9                                      Type |gO| to see the table of contents.
10
11==============================================================================
121. Indenting C style programs				*C-indenting*
13
14The basics for C style indenting are explained in section |30.2| of the user
15manual.
16
17Vim has options for automatically indenting C style program files. Many
18programming languages including Java and C++ follow very closely the
19formatting conventions established with C.  These options affect only the
20indent and do not perform other formatting.  There are additional options that
21affect other kinds of formatting as well as indenting, see |format-comments|,
22|fo-table|, |gq| and |formatting| for the main ones.
23
24There are in fact four main methods available for indentation, each one
25overrides the previous if it is enabled, or non-empty for 'indentexpr':
26'autoindent'	uses the indent from the previous line.
27'smartindent'	is like 'autoindent' but also recognizes some C syntax to
28		increase/reduce the indent where appropriate.
29'cindent'	Works more cleverly than the other two and is configurable to
30		different indenting styles.
31'indentexpr'	The most flexible of all: Evaluates an expression to compute
32		the indent of a line.  When non-empty this method overrides
33		the other ones.  See |indent-expression|.
34The rest of this section describes the 'cindent' option.
35
36Note that 'cindent' indenting does not work for every code scenario.  Vim
37is not a C compiler: it does not recognize all syntax.  One requirement is
38that toplevel functions have a "{" in the first column.  Otherwise they are
39easily confused with declarations.
40
41These five options control C program indenting:
42'cindent'	Enables Vim to perform C program indenting automatically.
43'cinkeys'	Specifies which keys trigger reindenting in insert mode.
44'cinoptions'	Sets your preferred indent style.
45'cinwords'	Defines keywords that start an extra indent in the next line.
46'cinscopedecls'	Defines strings that are recognized as a C++ scope
47		declaration.
48
49If 'lisp' is not on and 'equalprg' is empty, the "=" operator indents using
50Vim's built-in algorithm rather than calling an external program.
51
52See |autocommand| for how to set the 'cindent' option automatically for C code
53files and reset it for others.
54
55					*cinkeys-format* *indentkeys-format*
56The 'cinkeys' option is a string that controls Vim's indenting in response to
57typing certain characters or commands in certain contexts.  Note that this not
58only triggers C-indenting.  When 'indentexpr' is not empty 'indentkeys' is
59used instead.  The format of 'cinkeys' and 'indentkeys' is equal.
60
61The default is "0{,0},0),0],:,0#,!^F,o,O,e" which specifies that indenting
62occurs as follows:
63
64	"0{"	if you type "{" as the first character in a line
65	"0}"	if you type "}" as the first character in a line
66	"0)"	if you type ")" as the first character in a line
67	"0]"	if you type "]" as the first character in a line
68	":"	if you type ":" after a label or case statement
69	"0#"	if you type "#" as the first character in a line
70	"!^F"	if you type CTRL-F (which is not inserted)
71	"o"	if you type a <CR> anywhere or use the "o" command (not in
72		insert mode!)
73	"O"	if you use the "O" command (not in insert mode!)
74	"e"	if you type the second 'e' for an "else" at the start of a
75		line
76
77Characters that can precede each key:				*i_CTRL-F*
78!	When a "!" precedes the key, Vim will not insert the key but will
79	instead reindent the current line.  This allows you to define a
80	command key for reindenting the current line.  CTRL-F is the default
81	key for this.  Be careful if you define CTRL-I for this because CTRL-I
82	is the ASCII code for <Tab>.
83*	When a "*" precedes the key, Vim will reindent the line before
84	inserting the key.  If 'cinkeys' contains "*<Return>", Vim reindents
85	the current line before opening a new line.
860	When a zero precedes the key (but appears after "!" or "*") Vim will
87	reindent the line only if the key is the first character you type in
88	the line.  When used before "=" Vim will only reindent the line if
89	there is only white space before the word.
90
91When neither "!" nor "*" precedes the key, Vim reindents the line after you
92type the key.  So ";" sets the indentation of a line which includes the ";".
93
94Special key names:
95<>	Angle brackets mean spelled-out names of keys.  For example: "<Up>",
96	"<Ins>" (see |key-notation|).
97^	Letters preceded by a caret (^) are control characters.  For example:
98	"^F" is CTRL-F.
99o	Reindent a line when you use the "o" command or when Vim opens a new
100	line below the current one (e.g., when you type <Enter> in insert
101	mode).
102O	Reindent a line when you use the "O" command.
103e	Reindent a line that starts with "else" when you type the second 'e'.
104:	Reindent a line when a ':' is typed which is after a label or case
105	statement.  Don't reindent for a ":" in "class::method" for C++.  To
106	Reindent for any ":", use "<:>".
107=word	Reindent when typing the last character of "word".  "word" may
108	actually be part of another word.  Thus "=end" would cause reindenting
109	when typing the "d" in "endif" or "endwhile".  But not when typing
110	"bend".  Also reindent when completion produces a word that starts
111	with "word".  "0=word" reindents when there is only white space before
112	the word.
113=~word	Like =word, but ignore case.
114
115If you really want to reindent when you type 'o', 'O', 'e', '0', '<', '>',
116"*", ':' or '!', use "<o>", "<O>", "<e>", "<0>", "<<>", "<>>", "<*>", "<:>" or
117"<!>", respectively, for those keys.
118
119For an emacs-style indent mode where lines aren't indented every time you
120press <Enter> but only if you press <Tab>, I suggest: >
121	:set cinkeys=0{,0},:,0#,!<Tab>,!^F
122You might also want to switch off 'autoindent' then.
123
124Note: If you change the current line's indentation manually, Vim ignores the
125cindent settings for that line.  This prevents vim from reindenting after you
126have changed the indent by typing <BS>, <Tab>, or <Space> in the indent or
127used CTRL-T or CTRL-D.
128
129						*cinoptions-values*
130The 'cinoptions' option sets how Vim performs indentation.  The value after
131the option character can be one of these (N is any number):
132	N	indent N spaces
133	-N	indent N spaces to the left
134	Ns	N times 'shiftwidth' spaces
135	-Ns	N times 'shiftwidth' spaces to the left
136
137In the list below,
138"N" represents a number of your choice (the number can be negative).  When
139there is an 's' after the number, Vim multiplies the number by 'shiftwidth':
140"1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc.  You can use a
141decimal point, too: "-0.5s" is minus half a 'shiftwidth'.
142The examples below assume a 'shiftwidth' of 4.
143							*cino->*
144	>N    Amount added for "normal" indent.  Used after a line that should
145	      increase the indent (lines starting with "if", an opening brace,
146	      etc.).  (default 'shiftwidth').
147
148		cino=		    cino=>2		cino=>2s >
149		  if (cond)	      if (cond)		  if (cond)
150		  {		      {			  {
151		      foo;		foo;			  foo;
152		  }		      }			  }
153<
154							*cino-e*
155	eN    Add N to the prevailing indent inside a set of braces if the
156	      opening brace at the End of the line (more precise: is not the
157	      first character in a line).  This is useful if you want a
158	      different indent when the "{" is at the start of the line from
159	      when "{" is at the end of the line.  (default 0).
160
161		cino=		    cino=e2		cino=e-2 >
162		  if (cond) {	      if (cond) {	  if (cond) {
163		      foo;		    foo;	    foo;
164		  }		      }			  }
165		  else		      else		  else
166		  {		      {			  {
167		      bar;		  bar;		      bar;
168		  }		      }			  }
169<
170							*cino-n*
171	nN    Add N to the prevailing indent for a statement after an "if",
172	      "while", etc., if it is NOT inside a set of braces.  This is
173	      useful if you want a different indent when there is no "{"
174	      before the statement from when there is a "{" before it.
175	      (default 0).
176
177		cino=		    cino=n2		cino=n-2 >
178		  if (cond)	      if (cond)		  if (cond)
179		      foo;		    foo;	    foo;
180		  else		      else		  else
181		  {		      {			  {
182		      bar;		  bar;		      bar;
183		  }		      }			  }
184<
185							*cino-f*
186	fN    Place the first opening brace of a function or other block in
187	      column N.  This applies only for an opening brace that is not
188	      inside other braces and is at the start of the line.  What comes
189	      after the brace is put relative to this brace.  (default 0).
190
191		cino=		    cino=f.5s		cino=f1s >
192		  func()	      func()		  func()
193		  {			{		      {
194		      int foo;		    int foo;		  int foo;
195<
196							*cino-{*
197	`{N`    Place opening braces N characters from the prevailing indent.
198	      This applies only for opening braces that are inside other
199	      braces.  (default 0).
200
201		cino=		    cino={.5s		cino={1s >
202		  if (cond)	      if (cond)		  if (cond)
203		  {			{		      {
204		      foo;		  foo;		      foo;
205<
206							*cino-}*
207	`}N`    Place closing braces N characters from the matching opening
208	      brace.  (default 0).
209
210		cino=		    cino={2,}-0.5s	cino=}2 >
211		  if (cond)	      if (cond)		  if (cond)
212		  {			{		  {
213		      foo;		  foo;		      foo;
214		  }		      }			    }
215<
216							*cino-^*
217	^N    Add N to the prevailing indent inside a set of braces if the
218	      opening brace is in column 0.  This can specify a different
219	      indent for whole of a function (some may like to set it to a
220	      negative number).  (default 0).
221
222		cino=		    cino=^-2		cino=^-s >
223		  func()	      func()		  func()
224		  {		      {			  {
225		      if (cond)		if (cond)	  if (cond)
226		      {			{		  {
227			  a = b;	    a = b;	      a = b;
228		      }			}		  }
229		  }		      }			  }
230<
231							*cino-L*
232	LN    Controls placement of jump labels.  If N is negative, the label
233	      will be placed at column 1.  If N is non-negative, the indent of
234	      the label will be the prevailing indent minus N.  (default -1).
235
236		cino=               cino=L2             cino=Ls >
237		  func()              func()              func()
238		  {                   {                   {
239		      {                   {                   {
240		          stmt;               stmt;               stmt;
241		  LABEL:                    LABEL:            LABEL:
242		      }                   }                   }
243		  }                   }                   }
244<
245							*cino-:*
246	:N    Place case labels N characters from the indent of the switch().
247	      (default 'shiftwidth').
248
249		cino=		    cino=:0 >
250		  switch (x)	      switch(x)
251		  {		      {
252		      case 1:	      case 1:
253			  a = b;	  a = b;
254		      default:	      default:
255		  }		      }
256<
257							*cino-=*
258	=N    Place statements occurring after a case label N characters from
259	      the indent of the label.  (default 'shiftwidth').
260
261		cino=		    cino==10 >
262		   case 11:		case 11:  a = a + 1;
263		       a = a + 1;		  b = b + 1;
264<
265							*cino-l*
266	lN    If N != 0 Vim will align with a case label instead of the
267	      statement after it in the same line.
268
269		cino=			    cino=l1 >
270		    switch (a) {	      switch (a) {
271			case 1: {		  case 1: {
272				    break;	      break;
273				}		  }
274<
275							*cino-b*
276	bN    If N != 0 Vim will align a final "break" with the case label,
277	      so that case..break looks like a sort of block.  (default: 0).
278	      When using 1, consider adding "0=break" to 'cinkeys'.
279
280		cino=		    cino=b1 >
281		  switch (x)	      switch(x)
282		  {		      {
283		      case 1:		  case 1:
284			  a = b;	      a = b;
285			  break;	  break;
286
287		      default:		  default:
288			  a = 0;	      a = 0;
289			  break;	  break;
290		  }		      }
291<
292							*cino-g*
293	gN    Place C++ scope declarations N characters from the indent of the
294	      block they are in.  (default 'shiftwidth').  By default, a scope
295	      declaration is "public:", "protected:" or "private:".  This can
296	      be adjusted with the 'cinscopedecls' option.
297
298		cino=		    cino=g0 >
299		  {		      {
300		      public:	      public:
301			  a = b;	  a = b;
302		      private:	      private:
303		  }		      }
304<
305							*cino-h*
306	hN    Place statements occurring after a C++ scope declaration N
307	      characters from the indent of the label.  (default
308	      'shiftwidth').
309
310		cino=		    cino=h10 >
311		   public:		public:   a = a + 1;
312		       a = a + 1;		  b = b + 1;
313<
314							*cino-N*
315	NN    Indent inside C++ namespace N characters extra compared to a
316	      normal block.  (default 0).
317
318		cino=			   cino=N-s >
319		  namespace {                namespace {
320		      void function();       void function();
321		  }                          }
322
323		  namespace my               namespace my
324		  {                          {
325		      void function();       void function();
326		  }                          }
327<
328							*cino-E*
329	EN    Indent inside C++ linkage specifications (extern "C" or
330	      extern "C++") N characters extra compared to a normal block.
331	      (default 0).
332
333		cino=			   cino=E-s >
334		  extern "C" {               extern "C" {
335		      void function();       void function();
336		  }                          }
337
338		  extern "C"                 extern "C"
339		  {                          {
340		      void function();       void function();
341		  }                          }
342<
343							*cino-p*
344	pN    Parameter declarations for K&R-style function declarations will
345	      be indented N characters from the margin.  (default
346	      'shiftwidth').
347
348		cino=		    cino=p0		cino=p2s >
349		  func(a, b)	      func(a, b)	  func(a, b)
350		      int a;	      int a;			  int a;
351		      char b;	      char b;			  char b;
352<
353							*cino-t*
354	tN    Indent a function return type declaration N characters from the
355	      margin.  (default 'shiftwidth').
356
357		cino=		    cino=t0		cino=t7 >
358		      int	      int			 int
359		  func()	      func()		  func()
360<
361							*cino-i*
362	iN    Indent C++ base class declarations and constructor
363	      initializations, if they start in a new line (otherwise they
364	      are aligned at the right side of the ':').
365	      (default 'shiftwidth').
366
367		cino=			  cino=i0 >
368		  class MyClass :	    class MyClass :
369		      public BaseClass      public BaseClass
370		  {}			    {}
371		  MyClass::MyClass() :	    MyClass::MyClass() :
372		      BaseClass(3)	    BaseClass(3)
373		  {}			    {}
374<
375							*cino-+*
376	+N    Indent a continuation line (a line that spills onto the next)
377              inside a function N additional characters.  (default
378              'shiftwidth').
379              Outside of a function, when the previous line ended in a
380              backslash, the 2 * N is used.
381
382		cino=			  cino=+10 >
383		  a = b + 9 *		    a = b + 9 *
384		      c;			      c;
385<
386							*cino-c*
387	cN    Indent comment lines after the comment opener, when there is no
388	      other text with which to align, N characters from the comment
389	      opener.  (default 3).  See also |format-comments|.
390
391		cino=			  cino=c5 >
392		  /*			    /*
393		     text.			 text.
394		   */			     */
395<
396							*cino-C*
397	CN    When N is non-zero, indent comment lines by the amount specified
398	      with the c flag above even if there is other text behind the
399	      comment opener.  (default 0).
400
401		cino=c0			  cino=c0,C1 >
402		  /********		    /********
403		    text.		    text.
404		  ********/		    ********/
405<	      (Example uses ":set comments& comments-=s1:/* comments^=s0:/*")
406
407							*cino-/*
408	/N    Indent comment lines N characters extra.  (default 0).
409		cino=			  cino=/4 >
410		  a = b;		    a = b;
411		  /* comment */			/* comment */
412		  c = d;		    c = d;
413<
414							*cino-(*
415	(N    When in unclosed parentheses, indent N characters from the line
416	      with the unclosed parenthesis.  Add a 'shiftwidth' for every
417	      extra unclosed parentheses.  When N is 0 or the unclosed
418	      parenthesis is the first non-white character in its line, line
419	      up with the next non-white character after the unclosed
420	      parenthesis.  (default 'shiftwidth' * 2).
421
422		cino=			  cino=(0 >
423		  if (c1 && (c2 ||	    if (c1 && (c2 ||
424			      c3))		       c3))
425		      foo;			foo;
426		  if (c1 &&		    if (c1 &&
427			  (c2 || c3))		(c2 || c3))
428		     {			       {
429<
430							*cino-u*
431	uN    Same as (N, but for one nesting level deeper.
432	      (default 'shiftwidth').
433
434		cino=			  cino=u2 >
435		  if (c123456789	    if (c123456789
436			  && (c22345		    && (c22345
437			      || c3))		      || c3))
438<
439							*cino-U*
440	UN    When N is non-zero, do not ignore the indenting specified by
441	      ( or u in case that the unclosed parenthesis is the first
442	      non-white character in its line.  (default 0).
443
444		cino= or cino=(s	  cino=(s,U1 >
445		  c = c1 &&		    c = c1 &&
446		      (				(
447		       c2 ||			    c2 ||
448		       c3			    c3
449		      ) && c4;			) && c4;
450<
451							*cino-w*
452	wN    When in unclosed parentheses and N is non-zero and either
453	      using "(0" or "u0", respectively, or using "U0" and the unclosed
454	      parenthesis is the first non-white character in its line, line
455	      up with the character immediately after the unclosed parenthesis
456	      rather than the first non-white character.  (default 0).
457
458		cino=(0			  cino=(0,w1 >
459		  if (   c1		    if (   c1
460			 && (   c2		&& (   c2
461				|| c3))		    || c3))
462		      foo;			foo;
463<
464							*cino-W*
465	WN    When in unclosed parentheses and N is non-zero and either
466	      using "(0" or "u0", respectively and the unclosed parenthesis is
467	      the last non-white character in its line and it is not the
468	      closing parenthesis, indent the following line N characters
469	      relative to the outer context (i.e. start of the line or the
470	      next unclosed parenthesis).  (default: 0).
471
472		cino=(0			   cino=(0,W4 >
473		  a_long_line(		    a_long_line(
474			      argument,		argument,
475			      argument);	argument);
476		  a_short_line(argument,    a_short_line(argument,
477			       argument);		 argument);
478<
479							*cino-k*
480	kN    When in unclosed parentheses which follow "if", "for" or
481	      "while" and N is non-zero, overrides the behaviour defined by
482	      "(N": causes the indent to be N characters relative to the outer
483	      context (i.e. the line where "if", "for" or "while" is).  Has
484	      no effect on deeper levels of nesting.  Affects flags like "wN"
485	      only for the "if", "for" and "while" conditions.  If 0, defaults
486	      to behaviour defined by the "(N" flag.  (default: 0).
487
488		cino=(0			   cino=(0,ks >
489		  if (condition1	    if (condition1
490		      && condition2)		    && condition2)
491		      action();			action();
492		  function(argument1	    function(argument1
493			   && argument2);	     && argument2);
494<
495							*cino-m*
496	mN    When N is non-zero, line up a line starting with a closing
497	      parenthesis with the first character of the line with the
498	      matching opening parenthesis.  (default 0).
499
500		cino=(s			  cino=(s,m1 >
501		  c = c1 && (		    c = c1 && (
502		      c2 ||			c2 ||
503		      c3			c3
504		      ) && c4;		    ) && c4;
505		  if (			    if (
506		      c1 && c2			c1 && c2
507		     )			    )
508		      foo;			foo;
509<
510							*cino-M*
511	MN    When N is non-zero, line up a line starting with a closing
512	      parenthesis with the first character of the previous line.
513	      (default 0).
514
515		cino=			  cino=M1 >
516		  if (cond1 &&		    if (cond1 &&
517			 cond2			   cond2
518		     )				   )
519<
520				*java-cinoptions* *java-indenting* *cino-j*
521	jN    Indent Java anonymous classes correctly.  Also works well for
522	      Javascript.  The value 'N' is currently unused but must be
523	      non-zero (e.g. 'j1').  'j1' will indent for example the
524	      following code snippet correctly: >
525
526		object.add(new ChangeListener() {
527		    public void stateChanged(ChangeEvent e) {
528			do_something();
529		    }
530		});
531<
532			*javascript-cinoptions* *javascript-indenting* *cino-J*
533	JN    Indent JavaScript object declarations correctly by not confusing
534	      them with labels.  The value 'N' is currently unused but must be
535	      non-zero (e.g. 'J1').  If you enable this you probably also want
536	      to set |cino-j|. >
537
538		var bar = {
539		    foo: {
540			that: this,
541			some: ok,
542		    },
543		    "bar":{
544			a : 2,
545			b: "123abc",
546			x: 4,
547			"y": 5
548		    }
549		}
550<
551								*cino-)*
552	)N    Vim searches for unclosed parentheses at most N lines away.
553	      This limits the time needed to search for parentheses.  (default
554	      20 lines).
555
556								*cino-star*
557	`*N`    Vim searches for unclosed comments at most N lines away.  This
558	      limits the time needed to search for the start of a comment.
559	      If your `/* */` comments stop indenting after N lines this is the
560	      value you will want to change.
561	      (default 70 lines).
562
563								*cino-#*
564	#N    When N is non-zero recognize shell/Perl comments starting with
565	      '#', do not recognize preprocessor lines; allow right-shifting
566	      lines that start with "#".
567	      When N is zero (default): don't recognize '#' comments, do
568	      recognize preprocessor lines; right-shifting lines that start
569	      with "#" does not work.
570
571								*cino-P*
572	PN    When N is non-zero recognize C pragmas, and indent them like any
573	      other code; does not concern other preprocessor directives.
574	      When N is zero (default): don't recognize C pragmas, treating
575	      them like every other preprocessor directive.
576
577
578The defaults, spelled out in full, are: >
579	cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,E0,ps,ts,is,+s,
580			c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0,P0
581
582Vim puts a line in column 1 if:
583- It starts with '#' (preprocessor directives), if 'cinkeys' contains '#0'.
584- It starts with a label (a keyword followed by ':', other than "case" and
585  "default") and 'cinoptions' does not contain an 'L' entry with a positive
586  value.
587- Any combination of indentations causes the line to have less than 0
588  indentation.
589
590==============================================================================
5912. Indenting by expression				*indent-expression*
592
593The basics for using flexible indenting are explained in section |30.3| of the
594user manual.
595
596If you want to write your own indent file, it must set the 'indentexpr'
597option.  Setting the 'indentkeys' option is often useful.
598See the $VIMRUNTIME/indent/README.txt file for hints.
599See the $VIMRUNTIME/indent directory for examples.
600
601
602REMARKS ABOUT SPECIFIC INDENT FILES ~
603
604
605CLOJURE					*ft-clojure-indent* *clojure-indent*
606
607Clojure indentation differs somewhat from traditional Lisps, due in part to
608the use of square and curly brackets, and otherwise by community convention.
609These conventions are not universally followed, so the Clojure indent script
610offers a few configuration options.
611
612
613							*g:clojure_maxlines*
614
615Sets maximum scan distance of `searchpairpos()`.  Larger values trade
616performance for correctness when dealing with very long forms.  A value of
6170 will scan without limits.  The default is 300.
618
619
620						*g:clojure_fuzzy_indent*
621					*g:clojure_fuzzy_indent_patterns*
622					*g:clojure_fuzzy_indent_blacklist*
623
624The 'lispwords' option is a list of comma-separated words that mark special
625forms whose subforms should be indented with two spaces.
626
627For example:
628>
629	(defn bad []
630	      "Incorrect indentation")
631
632	(defn good []
633	  "Correct indentation")
634<
635If you would like to specify 'lispwords' with a |pattern| instead, you can use
636the fuzzy indent feature:
637>
638	" Default
639	let g:clojure_fuzzy_indent = 1
640	let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
641	let g:clojure_fuzzy_indent_blacklist =
642		\ ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
643<
644|g:clojure_fuzzy_indent_patterns| and |g:clojure_fuzzy_indent_blacklist| are
645lists of patterns that will be matched against the unqualified symbol at the
646head of a list.  This means that a pattern like `"^foo"` will match all these
647candidates: `foobar`, `my.ns/foobar`, and `#'foobar`.
648
649Each candidate word is tested for special treatment in this order:
650
651	1. Return true if word is literally in 'lispwords'
652	2. Return false if word matches a pattern in
653	   |g:clojure_fuzzy_indent_blacklist|
654	3. Return true if word matches a pattern in
655	   |g:clojure_fuzzy_indent_patterns|
656	4. Return false and indent normally otherwise
657
658
659					*g:clojure_special_indent_words*
660
661Some forms in Clojure are indented such that every subform is indented by only
662two spaces, regardless of 'lispwords'.  If you have a custom construct that
663should be indented in this idiosyncratic fashion, you can add your symbols to
664the default list below.
665>
666	" Default
667	let g:clojure_special_indent_words =
668	   \ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
669<
670
671					*g:clojure_align_multiline_strings*
672
673Align subsequent lines in multi-line strings to the column after the opening
674quote, instead of the same column.
675
676For example:
677>
678	(def default
679	  "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
680	  eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
681	  enim ad minim veniam, quis nostrud exercitation ullamco laboris
682	  nisi ut aliquip ex ea commodo consequat.")
683
684	(def aligned
685	  "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
686	   eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
687	   enim ad minim veniam, quis nostrud exercitation ullamco laboris
688	   nisi ut aliquip ex ea commodo consequat.")
689<
690
691						*g:clojure_align_subforms*
692
693By default, parenthesized compound forms that look like function calls and
694whose head subform is on its own line have subsequent subforms indented by
695two spaces relative to the opening paren:
696>
697	(foo
698	  bar
699	  baz)
700<
701Setting this option to `1` changes this behaviour so that all subforms are
702aligned to the same column, emulating the default behaviour of
703clojure-mode.el:
704>
705	(foo
706	 bar
707	 baz)
708<
709
710FORTRAN							*ft-fortran-indent*
711
712Block if, select case, select type, select rank,  where, forall, type,
713interface, associate, block, enum, critical, and change team constructs are
714indented.  The indenting of subroutines, functions, modules, and program
715blocks is optional.  Comments, labeled statements, and continuation lines are
716indented in free source form, whereas they are not indented in fixed source
717form because of the left margin requirements.  Hence manual indent corrections
718will be necessary for labeled statements and continuation lines when fixed
719source form is being used.  For further discussion of the method used for the
720detection of source format see |ft-fortran-syntax|.
721
722Do loops ~
723All do loops are left unindented by default.  Do loops can be unstructured in
724Fortran with (possibly multiple) loops ending on a labeled executable
725statement of almost arbitrary type.  Correct indentation requires
726compiler-quality parsing.  Old code with do loops ending on labeled statements
727of arbitrary type can be indented with elaborate programs such as Tidy.
728Structured do/continue loops are also left unindented because continue
729statements are used for purposes other than ending a do loop.  Programs such
730as Tidy can convert structured do/continue loops to the do/enddo form.  Do
731loops of the do/enddo variety can be indented.  If you use only structured
732loops of the do/enddo form, you should declare this by setting the
733fortran_do_enddo variable in your vimrc as follows >
734
735   let fortran_do_enddo=1
736
737in which case do loops will be indented.  If all your loops are of do/enddo
738type only in, say, .f90 files, then you should set a buffer flag with an
739autocommand such as >
740
741  au! BufRead,BufNewFile *.f90 let b:fortran_do_enddo=1
742
743to get do loops indented in .f90 files and left alone in Fortran files with
744other extensions such as .for.
745
746Program units ~
747Indenting of program units (subroutines, functions, modules, and program
748blocks) can be increased by setting the variable fortran_indent_more and can
749be decreased by setting the variable fortran_indent_less.  These variables
750can be set for all fortran files in your vimrc as follows >
751
752  let fortran_indent_less=1
753
754A finer level of control can be achieved by setting the corresponding
755buffer-local variable as follows >
756
757  let b:fortran_indent_less=1
758
759
760HTML				*ft-html-indent* *html-indent* *html-indenting*
761
762This is about variables you can set in your vimrc to customize HTML indenting.
763
764You can set the indent for the first line after <script> and <style>
765"blocktags" (default "zero"): >
766
767      :let g:html_indent_script1 = "inc"
768      :let g:html_indent_style1 = "inc"
769<
770      VALUE	MEANING ~
771      "zero"	zero indent
772      "auto"	auto indent (same indent as the blocktag)
773      "inc"	auto indent + one indent step
774
775You can set the indent for attributes after an open <tag line: >
776
777      :let g:html_indent_attribute = 1
778<
779      VALUE	MEANING ~
780      1		auto indent, one indent step more than <tag
781      2		auto indent, two indent steps (default)
782      > 2	auto indent, more indent steps
783
784Many tags increase the indent for what follows per default (see "Add Indent
785Tags" in the script).  You can add further tags with: >
786
787      :let g:html_indent_inctags = "html,body,head,tbody"
788
789You can also remove such tags with: >
790
791      :let g:html_indent_autotags = "th,td,tr,tfoot,thead"
792
793Default value is empty for both variables.  Note: the initial "inctags" are
794only defined once per Vim session.
795
796User variables are only read when the script is sourced.  To enable your
797changes during a session, without reloading the HTML file, you can manually
798do: >
799
800      :call HtmlIndent_CheckUserSettings()
801
802Detail:
803  Calculation of indent inside "blocktags" with "alien" content:
804      BLOCKTAG   INDENT EXPR	    WHEN APPLICABLE ~
805      <script> : {customizable}	    if first line of block
806	       : cindent(v:lnum)    if attributes empty or contain "java"
807	       : -1		    else (vbscript, tcl, ...)
808      <style>  : {customizable}	    if first line of block
809	       : GetCSSIndent()	    else
810      <!-- --> : -1
811
812IDRIS2							*ft-idris2-indent*
813
814Idris 2 indentation can be configured with several variables that control the
815indentation level for different language constructs:
816
817The "g:idris2_indent_if" variable controls the indentation of `then` and `else`
818blocks after `if` statements.  Defaults to 3.
819
820The "g:idris2_indent_case" variable controls the indentation of patterns in
821`case` expressions.  Defaults to 5.
822
823The "g:idris2_indent_let" variable controls the indentation after `let`
824bindings.  Defaults to 4.
825
826The "g:idris2_indent_rewrite" variable controls the indentation after `rewrite`
827expressions.  Defaults to 8.
828
829The "g:idris2_indent_where" variable controls the indentation of `where`
830blocks.  Defaults to 6.
831
832The "g:idris2_indent_do" variable controls the indentation in `do` blocks.
833Defaults to 3.
834
835Example configuration: >
836
837	let g:idris2_indent_if = 2
838	let g:idris2_indent_case = 4
839	let g:idris2_indent_let = 4
840	let g:idris2_indent_rewrite = 8
841	let g:idris2_indent_where = 6
842	let g:idris2_indent_do = 3
843<
844
845MATLAB			*ft-matlab-indent* *matlab-indent* *matlab-indenting*
846
847The setting Function indenting format in MATLAB Editor/Debugger Language
848Preferences corresponds to: >
849    :let g:MATLAB_function_indent = {0, 1 or 2 (default)}
850
851Where 0 is for Classic, 1 for Indent nested functions and 2 for Indent all
852functions.
853
854
855PHP				*ft-php-indent* *php-indent* *php-indenting*
856
857NOTE:	PHP files will be indented correctly only if PHP |syntax| is active.
858
859If you are editing a file in Unix 'fileformat' and '\r' characters are present
860before new lines, indentation won't proceed correctly ; you have to remove
861those useless characters first with a command like: >
862
863    :%s /\r$//g
864
865Or, you can simply |:let| the variable PHP_removeCRwhenUnix to 1 and the
866script will silently remove them when Vim loads a PHP file (at each |BufRead|).
867
868OPTIONS: ~
869
870PHP indenting can be altered in several ways by modifying the values of some
871global variables:
872
873					*php-comment* *PHP_autoformatcomment*
874To not enable auto-formatting of comments by default (if you want to use your
875own 'formatoptions'): >
876    :let g:PHP_autoformatcomment = 0
877
878Else, 't' will be removed from the 'formatoptions' string and "qrowcb" will be
879added, see |fo-table| for more information.
880
881
882							*PHP_outdentSLComments*
883To add extra indentation to single-line comments: >
884    :let g:PHP_outdentSLComments = N
885
886With N being the number of 'shiftwidth' to add.
887
888Only single-line comments will be affected such as: >
889    # Comment
890    // Comment
891    /* Comment */
892<
893
894							*PHP_default_indenting*
895To add extra indentation to every PHP lines with N being the number of
896'shiftwidth' to add: >
897    :let g:PHP_default_indenting = N
898
899For example, with N = 1, this will give:
900>
901    <?php
902	if (!isset($History_lst_sel))
903	    if (!isset($History_lst_sel))
904		if (!isset($History_lst_sel)) {
905		    $History_lst_sel=0;
906		} else
907		    $foo="bar";
908
909	$command_hist = TRUE;
910    ?>
911(Notice the extra indentation between the PHP container markers and the code)
912
913							*PHP_outdentphpescape*
914To indent PHP escape tags as the surrounding non-PHP code (only affects the
915PHP escape tags): >
916    :let g:PHP_outdentphpescape = 0
917<
918
919							*PHP_removeCRwhenUnix*
920To automatically remove '\r' characters when the 'fileformat' is set to Unix: >
921    :let g:PHP_removeCRwhenUnix = 1
922<
923
924							*PHP_BracesAtCodeLevel*
925To indent braces at the same level than the code they contain: >
926    :let g:PHP_BracesAtCodeLevel = 1
927
928This will give the following result: >
929    if ($foo)
930	{
931	foo();
932	}
933Instead of: >
934    if ($foo)
935    {
936	foo();
937    }
938
939NOTE:	Indenting will be a bit slower if this option is used because some
940	optimizations won't be available.
941
942					*PHP_vintage_case_default_indent*
943To indent 'case:' and 'default:' statements in switch() blocks: >
944    :let g:PHP_vintage_case_default_indent = 1
945
946In PHP braces are not required inside 'case/default' blocks therefore 'case:'
947and 'default:' are indented at the same level than the 'switch()' to avoid
948meaningless indentation.  You can use the above option to return to the
949traditional way.
950
951							*PHP_noArrowMatching*
952By default the indent script will indent multi-line chained calls by matching
953the position of the '->': >
954
955    $user_name_very_long->name()
956                        ->age()
957                        ->info();
958<
959You can revert to the classic way of indenting by setting this option to 1: >
960    :let g:PHP_noArrowMatching = 1
961<
962You will obtain the following result: >
963
964    $user_name_very_long->name()
965        ->age()
966        ->info();
967<
968
969					*PHP_IndentFunctionCallParameters*
970Extra indentation levels to add to parameters in multi-line function calls. >
971    let g:PHP_IndentFunctionCallParameters = 1
972
973Function call arguments will indent 1 extra level.  For two-space indentation: >
974
975    function call_the_thing(
976      $with_this,
977      $and_that
978    ) {
979      $this->do_the_thing(
980          $with_this,
981          $and_that
982      );
983    }
984<
985
986				*PHP_IndentFunctionDeclarationParameters*
987Extra indentation levels to add to arguments in multi-line function
988definitions. >
989    let g:PHP_IndentFunctionDeclarationParameters = 1
990<
991Function arguments in declarations will indent 1 extra level.  For two-space
992indentation: >
993
994    function call_the_thing(
995        $with_this,
996        $and_that
997    ) {
998      $this->do_the_thing(
999        $with_this,
1000        $and_that
1001      );
1002    }
1003<
1004
1005PYTHON							*ft-python-indent*
1006
1007The amount of indent can be set with the `g:python_indent` |Dictionary|, which
1008needs to be created before adding the items: >
1009	let g:python_indent = {}
1010The examples given are the defaults.  Note that the dictionary values are set
1011to an expression, so that you can change the value of 'shiftwidth' later
1012without having to update these values.
1013
1014Indent after an open paren: >
1015	let g:python_indent.open_paren = 'shiftwidth() * 2'
1016Indent after a nested paren: >
1017	let g:python_indent.nested_paren = 'shiftwidth()'
1018Indent for a continuation line: >
1019	let g:python_indent.continue = 'shiftwidth() * 2'
1020
1021By default, the closing paren on a multiline construct lines up under the
1022first non-whitespace character of the previous line.
1023If you prefer that it's lined up under the first character of the line that
1024starts the multiline construct, reset this key: >
1025	let g:python_indent.closed_paren_align_last_line = v:false
1026
1027The method uses |searchpair()| to look back for unclosed parentheses.  This
1028can sometimes be slow, thus it timeouts after 150 msec.  If you notice the
1029indenting isn't correct, you can set a larger timeout in msec: >
1030	let g:python_indent.searchpair_timeout = 500
1031
1032If looking back for unclosed parenthesis is still too slow, especially during
1033a copy-paste operation, or if you don't need indenting inside multi-line
1034parentheses, you can completely disable this feature: >
1035	let g:python_indent.disable_parentheses_indenting = 1
1036
1037For backward compatibility, these variables are also supported: >
1038	g:pyindent_open_paren
1039	g:pyindent_nested_paren
1040	g:pyindent_continue
1041	g:pyindent_searchpair_timeout
1042	g:pyindent_disable_parentheses_indenting
1043
1044
1045R								*ft-r-indent*
1046
1047Function arguments are aligned if they span for multiple lines.  If you prefer
1048do not have the arguments of functions aligned, put in your |vimrc|:
1049>
1050   let r_indent_align_args = 0
1051<
1052All lines beginning with a comment character, #, get the same indentation
1053level of the normal R code.  Users of Emacs/ESS may be used to have lines
1054beginning with a single # indented in the 40th column, ## indented as R code,
1055and ### not indented.  If you prefer that lines beginning with comment
1056characters are aligned as they are by Emacs/ESS, put in your |vimrc|:
1057>
1058   let r_indent_ess_comments = 1
1059<
1060If you prefer that lines beginning with a single # are aligned at a column
1061different from the 40th one, you should set a new value to the variable
1062r_indent_comment_column, as in the example below:
1063>
1064   let r_indent_comment_column = 30
1065<
1066Any code after a line that ends with "<-" is indented.  Emacs/ESS does not
1067indent the code if it is a top-level function.  If you prefer a behavior like
1068Emacs/ESS one in this regard, put in your |vimrc|:
1069>
1070   let r_indent_ess_compatible = 1
1071<
1072Below is an example of indentation with and without this option enabled:
1073>
1074   ### r_indent_ess_compatible = 1           ### r_indent_ess_compatible = 0
1075   foo <-                                    foo <-
1076       function(x)                               function(x)
1077   {                                             {
1078       paste(x)                                      paste(x)
1079   }                                             }
1080<
1081The code will be indented after lines that match the pattern
1082`'\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'`.  If you want indentation after
1083lines that match a different pattern, you should set the appropriate value of
1084`r_indent_op_pattern` in your |vimrc|.
1085
1086
1087SHELL							*ft-sh-indent*
1088
1089The amount of indent applied under various circumstances in a shell file can
1090be configured by setting the following keys in the |Dictionary|
1091b:sh_indent_defaults to a specific amount or to a |Funcref| that references a
1092function that will return the amount desired:
1093
1094b:sh_indent_options["default"]	Default amount of indent.
1095
1096b:sh_indent_options["continuation-line"]
1097				Amount of indent to add to a continued line.
1098
1099b:sh_indent_options["case-labels"]
1100				Amount of indent to add for case labels.
1101				(not actually implemented)
1102
1103b:sh_indent_options["case-statements"]
1104				Amount of indent to add for case statements.
1105
1106b:sh_indent_options["case-breaks"]
1107				Amount of indent to add (or more likely
1108				remove) for case breaks.
1109
1110VERILOG							*ft-verilog-indent*
1111
1112General block statements such as if, for, case, always, initial, function,
1113specify and begin, etc., are indented.  The module block statements (first
1114level blocks) are not indented by default.  you can turn on the indent with
1115setting a variable in the vimrc as follows: >
1116
1117  let b:verilog_indent_modules = 1
1118
1119then the module blocks will be indented.  To stop this, remove the variable: >
1120
1121  :unlet b:verilog_indent_modules
1122
1123To set the variable only for Verilog file.  The following statements can be
1124used: >
1125
1126  au BufReadPost * if exists("b:current_syntax")
1127  au BufReadPost *   if b:current_syntax == "verilog"
1128  au BufReadPost *     let b:verilog_indent_modules = 1
1129  au BufReadPost *   endif
1130  au BufReadPost * endif
1131
1132Furthermore, setting the variable b:verilog_indent_width to change the
1133indenting width (default is 'shiftwidth'): >
1134
1135  let b:verilog_indent_width = 4
1136  let b:verilog_indent_width = shiftwidth() * 2
1137
1138In addition, you can turn the verbose mode for debug issue: >
1139
1140  let b:verilog_indent_verbose = 1
1141
1142Make sure to do ":set cmdheight=2" first to allow the display of the message.
1143
1144
1145VHDL							*ft-vhdl-indent*
1146
1147Alignment of generic/port mapping statements are performed by default.  This
1148causes the following alignment example: >
1149
1150  ENTITY sync IS
1151  PORT (
1152         clk        : IN  STD_LOGIC;
1153         reset_n    : IN  STD_LOGIC;
1154         data_input : IN  STD_LOGIC;
1155         data_out   : OUT STD_LOGIC
1156       );
1157  END ENTITY sync;
1158
1159To turn this off, add >
1160
1161  let g:vhdl_indent_genportmap = 0
1162
1163to the vimrc file, which causes the previous alignment example to change: >
1164
1165  ENTITY sync IS
1166  PORT (
1167    clk        : IN  STD_LOGIC;
1168    reset_n    : IN  STD_LOGIC;
1169    data_input : IN  STD_LOGIC;
1170    data_out   : OUT STD_LOGIC
1171  );
1172  END ENTITY sync;
1173
1174
1175Alignment of right-hand side assignment "<=" statements are performed by
1176default.  This causes the following alignment example: >
1177
1178  sig_out <= (bus_a(1) AND
1179             (sig_b OR sig_c)) OR
1180             (bus_a(0) AND sig_d);
1181
1182To turn this off, add >
1183
1184  let g:vhdl_indent_rhsassign = 0
1185
1186to the vimrc file, which causes the previous alignment example to change: >
1187
1188  sig_out <= (bus_a(1) AND
1189    (sig_b OR sig_c)) OR
1190    (bus_a(0) AND sig_d);
1191
1192
1193Full-line comments (lines that begin with "--") are indented to be aligned
1194with the very previous line's comment, PROVIDED that a whitespace follows
1195after "--".
1196
1197For example: >
1198
1199  sig_a <= sig_b; -- start of a comment
1200                  -- continuation of the comment
1201                  -- more of the same comment
1202
1203While in Insert mode, after typing "-- " (note the space " "), hitting CTRL-F
1204will align the current "-- " with the previous line's "--".
1205
1206If the very previous line does not contain "--", THEN the full-line comment
1207will be aligned with the start of the next non-blank line that is NOT a
1208full-line comment.
1209
1210Indenting the following code: >
1211
1212  sig_c <= sig_d; -- comment 0
1213         -- comment 1
1214               -- comment 2
1215    --debug_code:
1216    --PROCESS(debug_in)
1217         --BEGIN
1218            --  FOR i IN 15 DOWNTO 0 LOOP
1219             --    debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
1220            --  END LOOP;
1221     --END PROCESS debug_code;
1222
1223      -- comment 3
1224  sig_e <= sig_f; -- comment 4
1225           -- comment 5
1226
1227results in: >
1228
1229  sig_c <= sig_d; -- comment 0
1230                  -- comment 1
1231                  -- comment 2
1232  --debug_code:
1233  --PROCESS(debug_in)
1234  --BEGIN
1235  --  FOR i IN 15 DOWNTO 0 LOOP
1236  --    debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
1237  --  END LOOP;
1238  --END PROCESS debug_code;
1239
1240  -- comment 3
1241  sig_e <= sig_f; -- comment 4
1242                  -- comment 5
1243
1244Notice that "--debug_code:" does not align with "-- comment 2"
1245because there is no whitespace that follows after "--" in "--debug_code:".
1246
1247Given the dynamic nature of indenting comments, indenting should be done
1248TWICE.  On the first pass, code will be indented.  On the second pass,
1249full-line comments will be indented according to the correctly indented code.
1250
1251
1252VIM							*ft-vim-indent*
1253							*g:vim_indent_cont*
1254For indenting Vim scripts there is one variable that specifies the amount of
1255indent for a continuation line, a line that starts with a backslash: >
1256
1257	:let g:vim_indent_cont = shiftwidth() * 3
1258
1259Three times shiftwidth is the default value.
1260
1261YAML							*ft-yaml-indent*
1262
1263By default, the yaml indent script does not try to detect multiline scalars.
1264If you want to enable this, set the following variable: >
1265
1266  let g:yaml_indent_multiline_scalar = 1
1267<
1268 vim:tw=78:ts=8:noet:ft=help:norl: