Skip to content

Commit c4a25c5

Browse files
committed
Update indentation section of the Vim help doc
1 parent b26db95 commit c4a25c5

File tree

2 files changed

+97
-46
lines changed

2 files changed

+97
-46
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ filetype plugin indent on
1717

1818
## Syntax highlighting
1919

20-
#### `g:clojure_syntax_keywords`
20+
### `g:clojure_syntax_keywords`
2121

2222
Syntax highlighting of public vars in `clojure.core` is provided by default,
2323
but additional symbols can be highlighted by adding them to the
@@ -41,7 +41,7 @@ will not be highlighted by default. This is useful for namespaces that have
4141
set `(:refer-clojure :only [])`.
4242

4343

44-
#### `g:clojure_discard_macro`
44+
### `g:clojure_discard_macro`
4545

4646
Set this variable to `1` to enable highlighting of the
4747
"[discard reader macro](https://clojure.org/guides/weird_characters#_discard)".
@@ -61,6 +61,8 @@ offers ways to adjust the indentation.
6161
> The indentation code has recently been rebuilt which included the
6262
> removal/replacement of the following configuration options:
6363
>
64+
> - `clojure_maxlines`
65+
> - `clojure_align_subforms`
6466
> - `clojure_align_multiline_strings`
6567
> - `clojure_fuzzy_indent`
6668
> - `clojure_fuzzy_indent_blacklist`

doc/clojure.txt

+93-44
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,117 @@ INTRODUCTION *clojure-introduction*
55
Clojure runtime files for Vim.
66

77

8-
CLOJURE *ft-clojure-indent* *clojure-indent*
8+
CLOJURE *ft-clojure-indent* *clojure-indent*
99

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.
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+
As these conventions are not universally followed, the Clojure indent script
13+
offers ways to adjust the indentation.
1314

14-
[1]: https://guide.clojure.style
1515

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.
16+
*g:clojure_indent_style*
17+
*b:clojure_indent_style*
1918

20-
*b:clojure_indent_rules*
21-
*g:clojure_indent_rules*
19+
The `clojure_indent_style` config option controls the general indentation style
20+
to use. Choose from several common presets:
2221

23-
TODO: add this option and write this section.
22+
* `standard` (default):
23+
Conventional Clojure indentation. (Clojure Style Guide [1]) >
24+
25+
(my-fn 1
26+
2)
2427
25-
*b:clojure_align_multiline_strings*
26-
*g:clojure_align_multiline_strings*
28+
(my-fn
29+
1
30+
2)
31+
<
32+
* `traditional`:
33+
Indent like traditional Lisps. >
34+
35+
(my-fn 1
36+
2)
2737
28-
Alter alignment of newly created lines within multi-line strings (and regular
29-
expressions).
38+
(my-fn
39+
1
40+
2)
41+
<
42+
* `uniform`:
43+
Indent uniformly to 2 spaces with no alignment (aka Tonsky indentation [2]).
3044
>
31-
;; let g:clojure_align_multiline_strings = 0 " Default
32-
(def default
33-
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
34-
eiusmod tempor incididunt ut labore et dolore magna aliqua.")
35-
36-
;; let g:clojure_align_multiline_strings = 1
37-
(def aligned
38-
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
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.")
45+
(my-fn 1
46+
2)
47+
48+
(my-fn
49+
1
50+
2)
4551
<
46-
NOTE: indenting the string with |=| will not alter the indentation of existing
47-
multi-line strings as that would break intentional formatting.
52+
[1]: https://guide.clojure.style/
53+
[2]: https://tonsky.me/blog/clojurefmt/
54+
55+
56+
*g:clojure_indent_rules*
57+
*b:clojure_indent_rules*
58+
59+
TODO: add this option and write this section.
60+
4861

49-
*g:clojure_align_subforms*
62+
*g:clojure_fuzzy_indent_patterns*
63+
*b:clojure_fuzzy_indent_patterns*
5064

51-
By default, parenthesized compound forms that look like function calls and
52-
whose head subform is on its own line have subsequent subforms indented by
53-
two spaces relative to the opening paren:
65+
TODO: add this option and write this section.
66+
67+
68+
*g:clojure_indent_multiline_strings*
69+
*b:clojure_indent_multiline_strings*
70+
71+
Control alignment of new lines within Clojure multi-line strings and regular
72+
expressions with `clojure_indent_multiline_strings`.
73+
74+
NOTE: indenting with |=| will not alter the indentation within multi-line
75+
strings, as this could break intentional formatting.
76+
77+
Pick from the following multi-line string indent styles:
78+
79+
* `standard` (default):
80+
Align to the front of the `"` or `#"` delimiter. Ideal for doc-strings.
5481
>
55-
(foo
56-
bar
57-
baz)
82+
|(def standard
83+
| "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
84+
| eiusmod tempor incididunt ut labore et dolore magna aliqua.")
5885
<
59-
Setting this option to `1` changes this behaviour so that all subforms are
60-
aligned to the same column, emulating the default behaviour of
61-
clojure-mode.el:
86+
* `pretty`:
87+
Align to the back of the `"` or `#"` delimiter.
6288
>
63-
(foo
64-
bar
65-
baz)
89+
|(def aligned
90+
| "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
91+
| eiusmod tempor incididunt ut labore et dolore magna aliqua.")
6692
<
93+
* `traditional`:
94+
No indent, align to left edge of the file.
95+
>
96+
|(def traditional
97+
| "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
98+
|eiusmod tempor incididunt ut labore et dolore magna aliqua.")
99+
<
100+
101+
*clojure-indent-deprecations*
102+
103+
During the Clojure indentation script rebuild, the following configuration
104+
options were removed/replaced:
105+
106+
* *g:clojure_maxlines* -> none
107+
* *g:clojure_cljfmt_compat*: -> |g:clojure_indent_style|
108+
* *g:clojure_align_subforms* -> |g:clojure_indent_style|
109+
* *g:clojure_align_multiline_strings* -> |g:clojure_indent_multiline_strings|
110+
* *g:clojure_special_indent_words*: -> |g:clojure_indent_rules|
111+
* *g:clojure_fuzzy_indent*: -> none
112+
* *g:clojure_fuzzy_indent_blacklist*: -> none
113+
* |'lispwords'| -> |g:clojure_indent_rules|
114+
67115

68116
CLOJURE *ft-clojure-syntax*
69117

118+
70119
*g:clojure_syntax_keywords*
71120

72121
Syntax highlighting of public vars in "clojure.core" is provided by default,

0 commit comments

Comments
 (0)