File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,14 @@ clojure-mode.el:
113113 baz)
114114<
115115
116+ *g:clojure_cljfmt_compat*
117+
118+ Try to be (more) compatible with `cljfmt` Clojure code formatting tool. Turns
119+ on single space indenting for forms starting with `:keywords` , `'symbols` ,
120+ `#'variables` and `@d ereferences` (it affects, for instance, `(:require ...)`
121+ clause in Clojure `ns` form).
122+
123+
116124CLOJURE *ft-clojure-syntax*
117125
118126 *g:clojure_syntax_keywords*
Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ if exists("*searchpairpos")
5151 let g: clojure_align_subforms = 0
5252 endif
5353
54+ if ! exists (' g:clojure_cljfmt_compat' )
55+ let g: clojure_cljfmt_compat = 0
56+ endif
57+
5458 function ! s: syn_id_name ()
5559 return synIDattr (synID (line (" ." ), col (" ." ), 0 ), " name" )
5660 endfunction
@@ -322,9 +326,16 @@ if exists("*searchpairpos")
322326 return [paren[0 ], paren[1 ] + (g: clojure_align_subforms ? 0 : &shiftwidth - 1 )]
323327 elseif w [1 ] == ' _'
324328 return paren
329+ elseif w [1 ] == " '" && g: clojure_cljfmt_compat
330+ return paren
325331 endif
326332 endif
327333
334+ " Paren indent for keywords, symbols and derefs
335+ if g: clojure_cljfmt_compat && w [0 ] = ~# " [:@']"
336+ return paren
337+ endif
338+
328339 " Test words without namespace qualifiers and leading reader macro
329340 " metacharacters.
330341 "
You can’t perform that action at this time.
0 commit comments