Skip to content

Commit 3bd91be

Browse files
committed
Update readme with new options summary
1 parent bc495e4 commit 3bd91be

1 file changed

Lines changed: 63 additions & 22 deletions

File tree

README.markdown

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,63 @@ default values below:
113113

114114
### `g:clojure_maxlines`
115115

116-
Maximum scan distance of searchpairpos().
116+
Maximum scan distance of searchpairpos(). Larger values trade performance
117+
for correctness when dealing with very long forms. A value of 0 means search
118+
without limits.
119+
```vim
120+
" Default
121+
let g:clojure_maxlines = 100
122+
```
123+
124+
### `g:clojure_fuzzy_indent`, `g:clojure_fuzzy_indent_patterns`, and `g:clojure_fuzzy_indent_blacklist`
125+
126+
The 'lispwords' option is a list of comma-separated words that mark special
127+
forms whose following lines must be indented as if the word is on the
128+
first line alone.
129+
130+
For example:
131+
```vim
132+
(defn good []
133+
"Correct indentation")
134+
135+
(defn bad []
136+
"Incorrect indentation")
137+
```
117138

139+
If you would like to match words that match a pattern, you can use the
140+
fuzzy indent feature. The defaults are:
118141
```vim
119-
" Default
120-
let g:clojure_maxlines = 100
142+
" Default
143+
let g:clojure_fuzzy_indent = 1
144+
let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
145+
let g:clojure_fuzzy_indent_blacklist = ['^with-meta$', '-fn$']
146+
147+
" Legacy comma-delimited string version; the list format above is
148+
" recommended. Note that patterns are implicitly anchored with ^ and $.
149+
let g:clojure_fuzzy_indent_patterns = 'with.*,def.*,let.*'
121150
```
122151

123-
### `g:clojure_fuzzy_indent` and `g:clojure_fuzzy_indent_patterns`
152+
`g:clojure_fuzzy_indent_patterns` and `g:clojure_fuzzy_indent_blacklist` are
153+
*Lists* of patterns that will be matched against the unqualified symbol at the
154+
head of a list. This means that a pattern like `"^foo"` will match all these
155+
candidates: `"foobar"`, `"my.ns/foobar"`, and `"#'foobar"`.
124156

125-
Indent words that match patterns as if they are included in `lispwords`.
157+
Each candidate word is tested for special treatment in this order:
126158

159+
1. Return true if word is literally in 'lispwords'
160+
2. Return false if word matches a pattern in `g:clojure_fuzzy_indent_blacklist`
161+
3. Return true if word matches a pattern in `g:clojure_fuzzy_indent_patterns`
162+
4. Return false and indent normally otherwise
163+
164+
### `g:clojure_special_indent_words`
165+
166+
Some forms in Clojure are indented so that every subform is indented only two
167+
spaces, regardless of 'lispwords'. If you have a custom construct that should
168+
be indented in this idiosyncratic fashion, you can add your symbols to the
169+
default list below.
127170
```vim
128-
" Default
129-
let g:clojure_fuzzy_indent = 1
130-
let g:clojure_fuzzy_indent_patterns = "with.*,def.*,let.*"
171+
" Default
172+
let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
131173
```
132174

133175
### `g:clojure_align_multiline_strings`
@@ -136,24 +178,23 @@ When indenting multiline strings, align subsequent lines to the column
136178
after the opening quote, instead of the same column.
137179

138180
For example:
139-
140181
```clojure
141-
(def default
142-
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
143-
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
144-
enim ad minim veniam, quis nostrud exercitation ullamco laboris
145-
nisi ut aliquip ex ea commodo consequat.")
146-
147-
(def aligned
148-
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
149-
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
150-
enim ad minim veniam, quis nostrud exercitation ullamco laboris
151-
nisi ut aliquip ex ea commodo consequat.")
182+
(def default
183+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
184+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
185+
enim ad minim veniam, quis nostrud exercitation ullamco laboris
186+
nisi ut aliquip ex ea commodo consequat.")
187+
188+
(def aligned
189+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
190+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
191+
enim ad minim veniam, quis nostrud exercitation ullamco laboris
192+
nisi ut aliquip ex ea commodo consequat.")
152193
```
153194

154195
```vim
155-
" Default
156-
let g:clojure_align_multiline_strings = 0
196+
" Default
197+
let g:clojure_align_multiline_strings = 0
157198
```
158199

159200
License and Acknowledgements

0 commit comments

Comments
 (0)