Skip to content

Commit a251814

Browse files
committed
Add indent option g:clojure_align_subforms
Closes #37
1 parent b583d85 commit a251814

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

doc/clojure.txt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ without limits.
2424
" Default
2525
let g:clojure_maxlines = 100
2626
<
27-
2827
*g:clojure_fuzzy_indent*
2928
*g:clojure_fuzzy_indent_patterns*
3029
*g:clojure_fuzzy_indent_blacklist*
@@ -78,7 +77,6 @@ default list below.
7877
let g:clojure_special_indent_words =
7978
\ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
8079
<
81-
8280
*g:clojure_align_multiline_strings*
8381

8482
Align subsequent lines in multiline strings to the column after the opening
@@ -103,6 +101,28 @@ This option is off by default.
103101
" Default
104102
let g:clojure_align_multiline_strings = 0
105103
<
104+
*g:clojure_align_subforms*
105+
106+
By default, parenthesized compound forms that look like function calls and
107+
whose head subform is on its own line have subsequent subforms indented by
108+
two spaces relative to the opening paren:
109+
>
110+
(foo
111+
bar
112+
baz)
113+
<
114+
Setting this option changes this behavior so that all subforms are aligned to
115+
the same column:
116+
>
117+
(foo
118+
bar
119+
baz)
120+
<
121+
This option is off by default.
122+
>
123+
" Default
124+
let g:clojure_align_subforms = 0
125+
<
106126

107127
ABOUT *clojure-about*
108128

indent/clojure.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ if exists("*searchpairpos")
5353
let g:clojure_align_multiline_strings = 0
5454
endif
5555

56+
if !exists('g:clojure_align_subforms')
57+
let g:clojure_align_subforms = 0
58+
endif
59+
5660
function! s:SynIdName()
5761
return synIDattr(synID(line("."), col("."), 0), "name")
5862
endfunction
@@ -284,7 +288,7 @@ if exists("*searchpairpos")
284288
call search('\v\_s', 'cW')
285289
call search('\v\S', 'W')
286290
if paren[0] < line(".")
287-
return paren[1] + &shiftwidth - 1
291+
return paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)
288292
endif
289293

290294
call search('\v\S', 'bW')

0 commit comments

Comments
 (0)