README.txt 1.7 KB

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