11# Clojure.vim
22
3- [ Clojure] [ ] syntax highlighting for Vim and Neovim, including:
3+ ** Configurable [ Clojure] [ ] syntax highlighting, indentation (and more) for Vim and Neovim! **
44
5- - [ Augmentable] ( #syntax-options ) syntax highlighting.
6- - [ Configurable] ( #indent-options ) indentation.
5+ <!-- TODO
76- Basic insert-mode completion of special forms and public vars in
87 `clojure.core`. (Invoke with `<C-x><C-o>` or `<C-x><C-u>`.)
8+ -->
99
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.
1014
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:
1816
1917``` vim
2018syntax on
2119filetype plugin indent on
2220```
2321
2422
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
3824
3925#### ` g:clojure_syntax_keywords `
4026
@@ -69,34 +55,54 @@ stacked discard macros (e.g. `#_#_`). This inconsitency is why this option is
6955disabled by default.
7056
7157
72- ### Indent options
58+ ## Indentation
7359
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.
7764
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' `
8274
8375
84- #### ` clojure_indent_rules `
76+ ### Indentation style
8577
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+ ```
9491
9592
96- #### ` clojure_align_multiline_strings `
93+ ### Indentation rules
9794
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.
100106
101107``` clojure
102108; ; let g:clojure_align_multiline_strings = 0 " Default
@@ -117,32 +123,15 @@ eiusmod tempor incididunt ut labore et dolore magna aliqua.")
117123
118124There is also a buffer-local (` b: ` ) version of this option.
119125
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-
124126
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
136128
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.
140132
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.)
146135
147136
148137## Contribute
@@ -157,18 +146,15 @@ Pull requests are welcome! Make sure to read the
157146_ Vim-clojure-static_ was created by [ Sung Pae] ( https://github.com/guns ) . The
158147original copies of the packaged runtime files came from
159148[ 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/ ) .
163150
164151
165152## License
166153
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.
170156
171- - Copyright © 2020–2021 , The clojure-vim contributors.
157+ - Copyright © 2020–2024 , The clojure-vim contributors.
172158- Copyright © 2013–2018, Sung Pae.
173159- Copyright © 2008–2012, Meikel Brandmeyer.
174160- Copyright © 2007–2008, Toralf Wittner.
0 commit comments