Rules for an indent file
" Only load this indent file when no other was loaded yet.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
To trigger the indenting after typing a key word like endif
, add the word to the cinkeys
option with +=
.
You normally set indentexpr
to evaluate a function and then define that function.
That function only needs to be defined once for as long as Vim is running. Add a test if the function exists and use ":finish", like this:
if exists("*GetMyIndent")
finish
endif
To test the indent file, see testdir/README.txt
.