README.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Bram@vim.org. Include instructions for detecting the file type for this
  8. language, by file name extension or by checking a few lines in the file.
  9. 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 Bram@vim.org.
  12. If you are the maintainer of an indent file and make improvements, e-mail the
  13. new version to Bram@vim.org.
  14. Rules for making an indent file:
  15. You should use this check for "b:did_indent":
  16. " Only load this indent file when no other was loaded yet.
  17. if exists("b:did_indent")
  18. finish
  19. endif
  20. let b:did_indent = 1
  21. Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
  22. to other buffers.
  23. To trigger the indenting after typing a word like "endif", add the word to the
  24. 'indentkeys' option with "+=".
  25. You normally set 'indentexpr' to evaluate a function and then define that
  26. function. That function only needs to be defined once for as long as Vim is
  27. running. Add a test if the function exists and use ":finish", like this:
  28. if exists("*GetMyIndent")
  29. finish
  30. endif
  31. The user may have several options set unlike you, try to write the file such
  32. that it works with any option settings. Also be aware of certain features not
  33. being compiled in.
  34. To test the indent file, see testdir/README.txt.