11# Clojure.vim
22
3- [ Vim ] [ ] runtime files for [ Clojure ] [ ] . This is a fork of [ vim-clojure-static ] [ ] .
3+ [ Clojure ] [ ] syntax highlighting for Vim and Neovim, including:
44
5+ - [ Augmentable] ( #syntax-options ) syntax highlighting.
6+ - [ Configurable] ( #indent-options ) indentation.
7+ - Basic insert-mode completion of special forms and public vars in
8+ ` clojure.core ` . (Invoke with ` <C-x><C-o> ` or ` <C-x><C-u> ` .)
59
6- ## Installation
710
8- These files ship with Vim version 7.3.803 and later and are periodically
9- merged into the official Vim repository.
11+ ## Installation
1012
11- If you are running an old version of Vim or if you would like to keep up with
12- the latest changes, you can install this repository as you would any other Vim
13- plugin.
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.
1415
15- Make sure that the following options are set in your vimrc so that all
16- features are enabled:
16+ Make sure that the following options are set in your vimrc so that all features
17+ are enabled:
1718
1819``` vim
1920syntax on
2021filetype plugin indent on
2122```
2223
23- ## Features
24-
25- * [ Augmentable] ( #syntax-options ) syntax highlighting for Clojure and
26- ClojureScript buffers.
2724
28- * [ Configurable ] ( #indent-options ) Clojure-specific indentation.
25+ ## Configuration
2926
30- * Basic insert mode completion for special forms and public vars in
31- ` clojure.core ` .
27+ ### Folding
3228
33- This is bound to both the ` 'omnifunc' ` and ` 'completefunc' ` options, which
34- can be invoked with the insert mode mappings ` <C-X><C-O> ` and ` <C-X><C-U> `
35- respectively .
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 .
3632
33+ (Note that this option will not work with scripts that redefine the bracket
34+ regions, such as rainbow parenphesis plugins.)
3735
38- ## Configuration
3936
40- ### Syntax Options
37+ ### Syntax options
4138
42- Syntax highlighting for public vars from ` clojure.core ` is provided by
43- default, but any symbol can be matched and highlighted by adding it to the
44- ` g:clojure_syntax_keywords ` or ` b:clojure_syntax_keywords ` variables:
39+ Syntax highlighting of public vars in ` clojure.core ` is provided by default,
40+ but additional symbols can be highlighted by adding them to the
41+ ` g:clojure_syntax_keywords ` variable.
4542
4643``` vim
4744let g:clojure_syntax_keywords = {
48- \ 'clojureMacro': ["defproject", "defcustom"],
49- \ 'clojureFunc': ["string/join", "string/replace"]
45+ \ 'clojureMacro': ["defproject", "defcustom"],
46+ \ 'clojureFunc': ["string/join", "string/replace"]
5047 \ }
5148```
5249
53- See ` s:clojure_syntax_keywords ` in the [ syntax script] ( syntax/clojure.vim ) for
54- a complete example.
50+ ( See ` s:clojure_syntax_keywords ` in the [ syntax script] ( syntax/clojure.vim ) for
51+ a complete example.)
5552
56- The global version of this variable is intended for users that always wish
57- to have a certain set of symbols highlighted in a certain way, while the
58- buffer-local version is intended for plugin authors who wish to highlight
59- symbols dynamically.
53+ There is also a buffer-local variant of this variable (` b:clojure_syntax_keywords ` )
54+ that is intended for use by plugin authors to highlight symbols dynamically.
6055
61- If the buffer flag ` b:clojure_syntax_without_core_keywords ` is set , vars from
62- ` clojure.core ` are not highlighted by default. This is useful for highlighting
63- namespaces that have set ` (:refer-clojure :only []) ` .
56+ By setting ` b:clojure_syntax_without_core_keywords ` , vars from ` clojure.core `
57+ will not be highlighted by default. This is useful for namespaces that have
58+ set ` (:refer-clojure :only []) ` .
6459
65- [ ` vim-clojure-highlight ` ] ( https://github.com/guns/vim-clojure-highlight ) uses
66- these variables to highlight extra vars when connected to a REPL.
6760
68- ### Indent Options
61+ ### Indent options
6962
7063Clojure indentation differs somewhat from traditional Lisps, due in part to
7164the use of square and curly brackets, and otherwise by community convention.
7265These conventions are not universally followed, so the Clojure indent script
73- offers a few configurable options, listed below.
66+ offers a few configuration options.
67+
68+ (If the current Vim does not include ` searchpairpos() ` , the indent script falls
69+ back to normal ` 'lisp' ` indenting, and the following options are ignored.)
7470
75- If the current vim does not include searchpairpos(), the indent script falls
76- back to normal ` 'lisp' ` indenting, and the following options are ignored.
7771
7872#### ` g:clojure_maxlines `
7973
80- Set maximum scan distance of searchpairpos(). Larger values trade performance
81- for correctness when dealing with very long forms. A value of 0 will scan
82- without limits.
74+ Sets maximum scan distance of ` searchpairpos() ` . Larger values trade
75+ performance for correctness when dealing with very long forms. A value of
76+ 0 will scan without limits. The default is 300 .
8377
84- ``` vim
85- " Default
86- let g:clojure_maxlines = 300
87- ```
8878
8979#### ` g:clojure_fuzzy_indent ` , ` g:clojure_fuzzy_indent_patterns ` , ` g:clojure_fuzzy_indent_blacklist `
9080
9181The ` 'lispwords' ` option is a list of comma-separated words that mark special
92- forms whose subforms must be indented with two spaces.
82+ forms whose subforms should be indented with two spaces.
9383
9484For example:
9585
@@ -109,15 +99,11 @@ the fuzzy indent feature:
10999let g:clojure_fuzzy_indent = 1
110100let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
111101let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
112-
113- " Legacy comma-delimited string version; the list format above is
114- " recommended. Note that patterns are implicitly anchored with ^ and $.
115- let g:clojure_fuzzy_indent_patterns = 'with.*,def.*,let.*'
116102```
117103
118104` g:clojure_fuzzy_indent_patterns ` and ` g:clojure_fuzzy_indent_blacklist ` are
119105lists of patterns that will be matched against the unqualified symbol at the
120- head of a list. This means that a pattern like ` "^foo" ` will match all these
106+ head of a list. This means that a pattern like ` "^foo" ` will match all these
121107candidates: ` foobar ` , ` my.ns/foobar ` , and ` #'foobar ` .
122108
123109Each candidate word is tested for special treatment in this order:
@@ -127,10 +113,11 @@ Each candidate word is tested for special treatment in this order:
1271133 . Return true if word matches a pattern in ` g:clojure_fuzzy_indent_patterns `
1281144 . Return false and indent normally otherwise
129115
116+
130117#### ` g:clojure_special_indent_words `
131118
132- Some forms in Clojure are indented so that every subform is indented only
133- two spaces, regardless of ` 'lispwords' ` . If you have a custom construct that
119+ Some forms in Clojure are indented such that every subform is indented by only
120+ two spaces, regardless of ` 'lispwords' ` . If you have a custom construct that
134121should be indented in this idiosyncratic fashion, you can add your symbols to
135122the default list below.
136123
@@ -139,9 +126,10 @@ the default list below.
139126let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
140127```
141128
129+
142130#### ` g:clojure_align_multiline_strings `
143131
144- Align subsequent lines in multiline strings to the column after the opening
132+ Align subsequent lines in multi-line strings to the column after the opening
145133quote, instead of the same column.
146134
147135For example:
@@ -160,12 +148,6 @@ For example:
160148 nisi ut aliquip ex ea commodo consequat." )
161149```
162150
163- This option is off by default.
164-
165- ``` vim
166- " Default
167- let g:clojure_align_multiline_strings = 0
168- ```
169151
170152#### ` g:clojure_align_subforms `
171153
@@ -179,30 +161,18 @@ two spaces relative to the opening paren:
179161 baz)
180162```
181163
182- Setting this option changes this behavior so that all subforms are aligned to
183- the same column, emulating the default behavior of clojure-mode.el:
164+ Setting this option to ` 1 ` changes this behaviour so that all subforms are
165+ aligned to the same column, emulating the default behaviour of
166+ [ clojure-mode.el] ( https://github.com/clojure-emacs/clojure-mode ) :
184167
185168``` clojure
186169(foo
187170 bar
188171 baz)
189172```
190173
191- This option is off by default.
192-
193- ``` vim
194- " Default
195- let g:clojure_align_subforms = 0
196- ```
197-
198-
199- ## Want to improve your Clojure development set up?
200-
201- Be sure to check out our list of [ suggested Vim plugins in the
202- Wiki] ( https://github.com/clojure-vim/clojure.vim/wiki/Plugins ) .
203-
204174
205- ## Contribute!
175+ ## Contribute
206176
207177Pull requests are welcome! Make sure to read the
208178[ ` CONTRIBUTING.md ` ] ( CONTRIBUTING.md ) for useful information.
@@ -212,8 +182,8 @@ Pull requests are welcome! Make sure to read the
212182
213183[ Clojure.vim] [ ] is a continuation of [ vim-clojure-static] [ ] .
214184_ Vim-clojure-static_ was created by [ Sung Pae] ( https://github.com/guns ) . The
215- original copies of the packaged runtime files came from [ Meikel
216- Brandmeyer] ( http://kotka.de/ ) 's [ VimClojure] [ ] project with permission.
185+ original copies of the packaged runtime files came from
186+ [ Meikel Brandmeyer] ( http://kotka.de/ ) 's [ VimClojure] [ ] project with permission.
217187
218188Thanks to [ Tim Pope] ( https://github.com/tpope/ ) for advice in
219189[ #vim] ( https://www.vi-improved.org/ ) .
@@ -236,7 +206,6 @@ for more details.
236206
237207<!-- Links -->
238208
239- [ vim ] : https://www.vim.org
240209[ clojure.vim ] : https://github.com/clojure-vim/clojure.vim
241210[ vim-clojure-static ] : https://github.com/guns/vim-clojure-static
242211[ vimclojure ] : https://www.vim.org/scripts/script.php?script_id=2501
0 commit comments