1
1
# Clojure.vim
2
2
3
- [ Clojure] [ ] syntax highlighting for Vim and Neovim, including:
3
+ ** Configurable [ Clojure] [ ] syntax highlighting, indentation (and more) for Vim and Neovim! **
4
4
5
- - [ Augmentable] ( #syntax-options ) syntax highlighting.
6
- - [ Configurable] ( #indent-options ) indentation.
5
+ <!-- TODO
7
6
- Basic insert-mode completion of special forms and public vars in
8
7
`clojure.core`. (Invoke with `<C-x><C-o>` or `<C-x><C-u>`.)
8
+ -->
9
9
10
+ > [ !TIP]
11
+ > This plugin comes packaged with Vim and Neovim. However if you would like to
12
+ > always use the latest version, you can install this plugin like you would any
13
+ > other.
10
14
11
- ## Installation
12
-
13
- These files are included in both Vim and Neovim. However if you would like the
14
- latest changes just install this repository like any other plugin.
15
-
16
- Make sure that the following options are set in your vimrc so that all features
17
- are enabled:
15
+ Make sure your vimrc contains the following options to enable all features:
18
16
19
17
``` vim
20
18
syntax on
21
19
filetype plugin indent on
22
20
```
23
21
24
22
25
- ## Configuration
26
-
27
- ### Folding
28
-
29
- Setting ` g:clojure_fold ` to ` 1 ` will enable the folding of Clojure code. Any
30
- list, vector or map that extends over more than one line can be folded using
31
- the standard Vim fold commands.
32
-
33
- (Note that this option will not work with scripts that redefine the bracket
34
- regions, such as rainbow parenphesis plugins.)
35
-
36
-
37
- ### Syntax options
23
+ ## Syntax highlighting
38
24
39
25
#### ` g:clojure_syntax_keywords `
40
26
@@ -69,34 +55,54 @@ stacked discard macros (e.g. `#_#_`). This inconsitency is why this option is
69
55
disabled by default.
70
56
71
57
72
- ### Indent options
58
+ ## Indentation
73
59
74
- By default Clojure.vim will attempt to follow the indentation rules in the
75
- [ Clojure Style Guide] ( https://guide.clojure.style ) , but various configuration
76
- options are provided to alter the indentation as you prefer.
60
+ Clojure indentation differs somewhat from traditional Lisps, due in part to the
61
+ use of square and curly brackets, and otherwise by community convention. As
62
+ these conventions are not universally followed, the Clojure indent script
63
+ offers ways to adjust the indentaion.
77
64
78
- > ** Warning** <br >
79
- > If your installation of Vim does not include ` searchpairpos() ` , the indent
80
- > script falls back to normal ` 'lisp' ` and ` 'lispwords' ` indenting, ignoring
81
- > the following indentation options.
65
+ > [ !WARNING]
66
+ > The indentation code has recently been rebuilt which included the removal of
67
+ > the following configuration options:
68
+ >
69
+ > - ` clojure_fuzzy_indent `
70
+ > - ` clojure_fuzzy_indent_blacklist `
71
+ > - ` clojure_special_indent_words `
72
+ > - ` clojure_cljfmt_compat `
73
+ > - ` 'lispwords' `
82
74
83
75
84
- #### ` clojure_indent_rules `
76
+ ### Indentation style
85
77
86
- > ** Note** <br >
87
- > The indentation code was recently rebuilt, which included the removal of
88
- > several former configuration options (` clojure_fuzzy_indent ` ,
89
- > ` clojure_fuzzy_indent_patterns ` , ` clojure_fuzzy_indent_blacklist ` ,
90
- > ` clojure_special_indent_words ` , ` clojure_cljfmt_compat ` and now ignores the
91
- > value of ` 'lispwords' ` ).
92
- >
93
- > All of those options were rolled into this new option.
78
+ The ` clojure_indent_style ` config option controls the general indentation style
79
+ to use. Choose from several common presets:
80
+
81
+ | Value | Default | Description |
82
+ | -------| ---------| -------------|
83
+ | ` standard ` | ✅ | Conventional Clojure indentation. ([ _ Clojure Style Guide_ ] ( https://guide.clojure.style/ ) .) |
84
+ | ` traditional ` | | Indent like traditional Lisps. (Earlier versions of Clojure.vim indented like this.) |
85
+ | ` uniform ` | | Indent uniformly to 2 spaces with no alignment (a.k.a. [ _ Tonsky_ indentation] ( https://tonsky.me/blog/clojurefmt/ ) ). |
86
+
87
+ ``` vim
88
+ let g:clojure_indent_style = 'uniform' " Set the default indent style...
89
+ let b:clojure_indent_style = 'traditional' " ...or override the default per-buffer.
90
+ ```
94
91
95
92
96
- #### ` clojure_align_multiline_strings `
93
+ ### Indentation rules
97
94
98
- Alter alignment of newly created lines within multi-line strings (and regular
99
- expressions).
95
+ ` clojure_indent_rules `
96
+
97
+
98
+ ### Multi-line strings
99
+
100
+ Control alignment of _ new_ lines within Clojure multi-line strings and regular
101
+ expressions with ` clojure_align_multiline_strings ` .
102
+
103
+ > [ !NOTE]
104
+ > Indenting with ` = ` will not alter the indentation within multi-line strings,
105
+ > as this could break intentional formatting.
100
106
101
107
``` clojure
102
108
; ; let g:clojure_align_multiline_strings = 0 " Default
@@ -117,32 +123,15 @@ eiusmod tempor incididunt ut labore et dolore magna aliqua.")
117
123
118
124
There is also a buffer-local (` b: ` ) version of this option.
119
125
120
- > ** Note** <br >
121
- > Indenting the string with ` = ` will not alter the indentation of existing
122
- > multi-line strings as that would break intentional formatting.
123
-
124
126
125
- #### ` clojure_align_subforms `
126
-
127
- By default, parenthesized compound forms that look like function calls and
128
- whose head subform is on its own line have subsequent subforms indented by
129
- two spaces relative to the opening paren:
130
-
131
- ``` clojure
132
- (foo
133
- bar
134
- baz)
135
- ```
127
+ ## Code folding
136
128
137
- Setting this option to ` 1 ` changes this behaviour so that all subforms are
138
- aligned to the same column, emulating the default behaviour of
139
- [ clojure-mode.el ] ( https://github.com/clojure-emacs/clojure-mode ) :
129
+ Setting ` g:clojure_fold ` to ` 1 ` will enable the folding of Clojure code. Any
130
+ list, vector or map that extends over more than one line can be folded using
131
+ the standard Vim fold commands.
140
132
141
- ``` clojure
142
- (foo
143
- bar
144
- baz)
145
- ```
133
+ (Note that this option will not work with scripts that redefine the bracket
134
+ regions, such as rainbow parenphesis plugins.)
146
135
147
136
148
137
## Contribute
@@ -157,18 +146,15 @@ Pull requests are welcome! Make sure to read the
157
146
_ Vim-clojure-static_ was created by [ Sung Pae] ( https://github.com/guns ) . The
158
147
original copies of the packaged runtime files came from
159
148
[ Meikel Brandmeyer] ( http://kotka.de/ ) 's [ VimClojure] [ ] project with permission.
160
-
161
- Thanks to [ Tim Pope] ( https://github.com/tpope/ ) for advice in
162
- [ #vim] ( https://www.vi-improved.org/ ) .
149
+ Thanks to [ Tim Pope] ( https://github.com/tpope/ ) for advice in [ #vim] ( https://www.vi-improved.org/ ) .
163
150
164
151
165
152
## License
166
153
167
- Clojure.vim is licensed under the [ Vim
168
- License] ( http://vimdoc.sourceforge.net/htmldoc/uganda.html#license ) for
169
- distribution with Vim.
154
+ Clojure.vim is licensed under the [ Vim License] ( http://vimdoc.sourceforge.net/htmldoc/uganda.html#license )
155
+ for distribution with Vim.
170
156
171
- - Copyright © 2020–2021 , The clojure-vim contributors.
157
+ - Copyright © 2020–2024 , The clojure-vim contributors.
172
158
- Copyright © 2013–2018, Sung Pae.
173
159
- Copyright © 2008–2012, Meikel Brandmeyer.
174
160
- Copyright © 2007–2008, Toralf Wittner.
0 commit comments