blob: 05ab126c8cb0bd202acd0eaeee284f05e23e6df4 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001This directory contains files to automatically compute the indent for a
2type of file.
3
4If you want to add your own indent file for your personal use, read the docs
5at ":help indent-expression". Looking at the existing files should give you
6inspiration.
7
8If you make a new indent file which would be useful for others, please send it
Christian Brabandte978b452023-08-13 10:33:05 +02009to the vim-dev mailing list <vim-dev@vim.org>. Include instructions for
10detecting the file type for this language, by file name extension or by
11checking a few lines in the file. And please stick to the rules below.
Bram Moolenaar071d4272004-06-13 20:20:40 +000012
13If you have remarks about an existing file, send them to the maintainer of
Christian Brabandt96d6c4a2023-08-13 18:17:21 +020014that file. Only when you get no response send a message to the vim-dev
15mailing list: <vim-dev@vim.org>.
Bram Moolenaar071d4272004-06-13 20:20:40 +000016
17If you are the maintainer of an indent file and make improvements, e-mail the
Christian Brabandt16889382023-08-13 17:53:07 +020018new version to the vim-dev mailing list: <vim-dev@vim.org>.
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20
21Rules for making an indent file:
22
23You should use this check for "b:did_indent":
24
25 " Only load this indent file when no other was loaded yet.
26 if exists("b:did_indent")
27 finish
28 endif
29 let b:did_indent = 1
30
31Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
32to other buffers.
33
34To trigger the indenting after typing a word like "endif", add the word to the
Bram Moolenaar75ab5902022-04-18 15:36:40 +010035'indentkeys' option with "+=".
Bram Moolenaar071d4272004-06-13 20:20:40 +000036
37You normally set 'indentexpr' to evaluate a function and then define that
38function. That function only needs to be defined once for as long as Vim is
39running. Add a test if the function exists and use ":finish", like this:
40 if exists("*GetMyIndent")
41 finish
42 endif
43
44The user may have several options set unlike you, try to write the file such
45that it works with any option settings. Also be aware of certain features not
46being compiled in.
Bram Moolenaarc0fe4972018-10-25 16:53:19 +020047
48To test the indent file, see testdir/README.txt.