annotate runtime/indent/README.txt @ 12289:294f510f6d35 v8.0.1024

patch 8.0.1024: folds lost when session file has a buffer in two windows commit https://github.com/vim/vim/commit/4bebc9a0565670b853d227f81a9a31eafdb47eed Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 30 21:07:38 2017 +0200 patch 8.0.1024: folds lost when session file has a buffer in two windows Problem: Manual folds are lost when a session file has the same buffer in two windows. (Jeansen) Solution: Use ":edit" only once. (Christian Brabandt, closes #1958)
author Christian Brabandt <cb@256bit.org>
date Wed, 30 Aug 2017 21:15:04 +0200
parents 3fc0f57ecb91
children 19b757c6c6a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 This directory contains files to automatically compute the indent for a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 type of file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 If you want to add your own indent file for your personal use, read the docs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 at ":help indent-expression". Looking at the existing files should give you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 inspiration.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 If you make a new indent file which would be useful for others, please send it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 to Bram@vim.org. Include instructions for detecting the file type for this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 language, by file name extension or by checking a few lines in the file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 And please stick to the rules below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 If you have remarks about an existing file, send them to the maintainer of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 that file. Only when you get no response send a message to Bram@vim.org.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 If you are the maintainer of an indent file and make improvements, e-mail the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 new version to Bram@vim.org.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 Rules for making an indent file:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 You should use this check for "b:did_indent":
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " Only load this indent file when no other was loaded yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 to other buffers.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 To trigger the indenting after typing a word like "endif", add the word to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 'cinkeys' option with "+=".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 You normally set 'indentexpr' to evaluate a function and then define that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 function. That function only needs to be defined once for as long as Vim is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 running. Add a test if the function exists and use ":finish", like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 if exists("*GetMyIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 The user may have several options set unlike you, try to write the file such
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 that it works with any option settings. Also be aware of certain features not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 being compiled in.