-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathclojure.txt
184 lines (136 loc) · 5.58 KB
/
clojure.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
*clojure.txt* Clojure runtime files
INTRODUCTION *clojure-introduction*
Clojure runtime files for Vim.
CLOJURE *ft-clojure-indent* *clojure-indent*
Clojure indentation differs somewhat from traditional Lisps, due in part to
the use of square and curly brackets, and otherwise by community convention.
These conventions are not universally followed, so the Clojure indent script
offers a few configuration options.
(If the current Vim does not include |searchpairpos()|, the indent script falls
back to normal 'lisp' indenting, and the following options are ignored.)
*g:clojure_maxlines*
Sets maximum scan distance of `searchpairpos()`. Larger values trade
performance for correctness when dealing with very long forms. A value of
0 will scan without limits. The default is 300.
*g:clojure_fuzzy_indent*
*g:clojure_fuzzy_indent_patterns*
*g:clojure_fuzzy_indent_blacklist*
The 'lispwords' option is a list of comma-separated words that mark special
forms whose subforms should be indented with two spaces.
For example:
>
(defn bad []
"Incorrect indentation")
(defn good []
"Correct indentation")
<
If you would like to specify 'lispwords' with a |pattern| instead, you can use
the fuzzy indent feature:
>
" Default
let g:clojure_fuzzy_indent = 1
let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
let g:clojure_fuzzy_indent_blacklist =
\ ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
<
|g:clojure_fuzzy_indent_patterns| and |g:clojure_fuzzy_indent_blacklist| are
lists of patterns that will be matched against the unqualified symbol at the
head of a list. This means that a pattern like `"^foo"` will match all these
candidates: `foobar`, `my.ns/foobar`, and `#'foobar`.
Each candidate word is tested for special treatment in this order:
1. Return true if word is literally in 'lispwords'
2. Return false if word matches a pattern in
|g:clojure_fuzzy_indent_blacklist|
3. Return true if word matches a pattern in
|g:clojure_fuzzy_indent_patterns|
4. Return false and indent normally otherwise
*g:clojure_special_indent_words*
Some forms in Clojure are indented such that every subform is indented by only
two spaces, regardless of 'lispwords'. If you have a custom construct that
should be indented in this idiosyncratic fashion, you can add your symbols to
the default list below.
>
" Default
let g:clojure_special_indent_words =
\ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
<
*g:clojure_align_multiline_strings*
Align subsequent lines in multi-line strings to the column after the opening
quote, instead of the same column.
For example:
>
(def default
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.")
(def aligned
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.")
<
*g:clojure_align_subforms*
By default, parenthesized compound forms that look like function calls and
whose head subform is on its own line have subsequent subforms indented by
two spaces relative to the opening paren:
>
(foo
bar
baz)
<
Setting this option to `1` changes this behaviour so that all subforms are
aligned to the same column, emulating the default behaviour of
clojure-mode.el:
>
(foo
bar
baz)
<
CLOJURE *ft-clojure-syntax*
*g:clojure_syntax_keywords*
Syntax highlighting of public vars in "clojure.core" is provided by default,
but additional symbols can be highlighted by adding them to the
|g:clojure_syntax_keywords| variable. The value should be a |Dictionary| of
syntax group names, each containing a |List| of identifiers.
>
let g:clojure_syntax_keywords = {
\ 'clojureMacro': ["defproject", "defcustom"],
\ 'clojureFunc': ["string/join", "string/replace"]
\ }
<
Refer to the Clojure syntax script for valid syntax group names.
There is also *b:clojure_syntax_keywords* which is a buffer-local variant of
this variable intended for use by plugin authors to highlight symbols
dynamically.
By setting the *b:clojure_syntax_without_core_keywords* variable, vars from
"clojure.core" will not be highlighted by default. This is useful for
namespaces that have set `(:refer-clojure :only [])`
*g:clojure_fold*
Setting |g:clojure_fold| to `1` will enable the folding of Clojure code. Any
list, vector or map that extends over more than one line can be folded using
the standard Vim |fold-commands|.
*g:clojure_discard_macro*
Set this variable to `1` to enable basic highlighting of Clojure's "discard
reader macro".
>
#_(defn foo [x]
(println x))
<
Note that this option will not correctly highlight stacked discard macros
(e.g. `#_#_`).
ABOUT *clojure-about*
This document and associated runtime files are maintained at:
https://github.com/clojure-vim/clojure.vim
Distributed under the Vim license. See |license|.
syntax/clojure.vim
Copyright 2007-2008 (c) Toralf Wittner <[email protected]>
Copyright 2008-2012 (c) Meikel Brandmeyer <[email protected]>
ftdetect/clojure.vim,
ftplugin/clojure.vim,
indent/clojure.vim
Copyright 2008-2012 (c) Meikel Brandmeyer <[email protected]>
Modified and relicensed under the Vim License for distribution with Vim:
Copyright 2013-2014 (c) Sung Pae <[email protected]>
Last Change: %%RELEASE_DATE%%
vim:tw=78:noet:sw=8:sts=8:ts=8:ft=help:norl: