@@ -7,92 +7,44 @@ Clojure runtime files for Vim.
7
7
8
8
CLOJURE *ft-clojure-indent* *clojure-indent*
9
9
10
- Clojure indentation differs somewhat from traditional Lisps, due in part to
11
- the use of square and curly brackets, and otherwise by community convention.
12
- These conventions are not universally followed, so the Clojure indent script
13
- offers a few configuration options.
10
+ By default Clojure.vim will attempt to follow the indentation rules in the
11
+ Clojure Style Guide, [1] but various configuration options are provided to
12
+ alter the indentation as you prefer.
14
13
15
- (If the current Vim does not include | searchpairpos() | , the indent script falls
16
- back to normal 'lisp' indenting, and the following options are ignored.)
14
+ [1]: https://guide.clojure.style
17
15
16
+ WARNING: if your installation of Vim does not include `searchpairpos ()` , the
17
+ indent script falls back to normal 'lisp' and 'lispwords' indenting,
18
+ ignoring the following indentation options.
18
19
19
- *g:clojure_maxlines*
20
+ *b:clojure_indent_rules*
21
+ *g:clojure_indent_rules*
20
22
21
- Sets maximum scan distance of `searchpairpos ()` . Larger values trade
22
- performance for correctness when dealing with very long forms. A value of
23
- 0 will scan without limits. The default is 300.
24
-
25
-
26
- *g:clojure_fuzzy_indent*
27
- *g:clojure_fuzzy_indent_patterns*
28
- *g:clojure_fuzzy_indent_blacklist*
29
-
30
- The 'lispwords' option is a list of comma-separated words that mark special
31
- forms whose subforms should be indented with two spaces.
32
-
33
- For example:
34
- >
35
- (defn bad []
36
- "Incorrect indentation")
37
-
38
- (defn good []
39
- "Correct indentation")
40
- <
41
- If you would like to specify 'lispwords' with a | pattern | instead, you can use
42
- the fuzzy indent feature:
43
- >
44
- " Default
45
- let g:clojure_fuzzy_indent = 1
46
- let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
47
- let g:clojure_fuzzy_indent_blacklist =
48
- \ ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
49
- <
50
- | g:clojure_fuzzy_indent_patterns | and | g:clojure_fuzzy_indent_blacklist | are
51
- lists of patterns that will be matched against the unqualified symbol at the
52
- head of a list. This means that a pattern like `" ^foo" ` will match all these
53
- candidates: `foobar` , `my.ns/foobar` , and `#'foobar` .
54
-
55
- Each candidate word is tested for special treatment in this order:
56
-
57
- 1. Return true if word is literally in 'lispwords'
58
- 2. Return false if word matches a pattern in
59
- | g:clojure_fuzzy_indent_blacklist |
60
- 3. Return true if word matches a pattern in
61
- | g:clojure_fuzzy_indent_patterns |
62
- 4. Return false and indent normally otherwise
63
-
64
-
65
- *g:clojure_special_indent_words*
66
-
67
- Some forms in Clojure are indented such that every subform is indented by only
68
- two spaces, regardless of 'lispwords' . If you have a custom construct that
69
- should be indented in this idiosyncratic fashion, you can add your symbols to
70
- the default list below.
71
- >
72
- " Default
73
- let g:clojure_special_indent_words =
74
- \ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
75
- <
23
+ TODO: add this option and write this section.
76
24
25
+ *b:clojure_align_multiline_strings*
77
26
*g:clojure_align_multiline_strings*
78
27
79
- Align subsequent lines in multi-line strings to the column after the opening
80
- quote, instead of the same column.
81
-
82
- For example:
28
+ Alter alignment of newly created lines within multi-line strings (and regular
29
+ expressions).
83
30
>
31
+ ;; let g:clojure_align_multiline_strings = 0 " Default
84
32
(def default
85
33
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
86
- eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
87
- enim ad minim veniam, quis nostrud exercitation ullamco laboris
88
- nisi ut aliquip ex ea commodo consequat.")
34
+ eiusmod tempor incididunt ut labore et dolore magna aliqua.")
89
35
36
+ ;; let g:clojure_align_multiline_strings = 1
90
37
(def aligned
91
38
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
92
- eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
93
- enim ad minim veniam, quis nostrud exercitation ullamco laboris
94
- nisi ut aliquip ex ea commodo consequat.")
39
+ eiusmod tempor incididunt ut labore et dolore magna aliqua.")
40
+
41
+ ;; let g:clojure_align_multiline_strings = -1
42
+ (def traditional
43
+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
44
+ eiusmod tempor incididunt ut labore et dolore magna aliqua.")
95
45
<
46
+ NOTE: indenting the string with | = | will not alter the indentation of existing
47
+ multi-line strings as that would break intentional formatting.
96
48
97
49
*g:clojure_align_subforms*
98
50
@@ -113,14 +65,6 @@ clojure-mode.el:
113
65
baz)
114
66
<
115
67
116
- *g:clojure_cljfmt_compat*
117
-
118
- Try to be (more) compatible with `cljfmt` Clojure code formatting tool. Turns
119
- on single space indenting for forms starting with `:keywords` , `'symbols` ,
120
- `#'variables` and `@d ereferences` (it affects, for instance, `(:require ...)`
121
- clause in Clojure `ns` form).
122
-
123
-
124
68
CLOJURE *ft-clojure-syntax*
125
69
126
70
*g:clojure_syntax_keywords*
0 commit comments