7
7
" License: Vim (see :h license)
8
8
" Repository: https://github.com/clojure-vim/clojure.vim
9
9
10
+ " NOTE: To debug this code, make sure to "set debug+=msg" otherwise errors
11
+ " will occur silently.
12
+
10
13
if exists (" b:did_indent" ) | finish | endif
11
14
let b: did_indent = 1
12
15
@@ -19,9 +22,6 @@ setlocal noautoindent nosmartindent nolisp
19
22
setlocal softtabstop = 2 shiftwidth = 2 expandtab
20
23
setlocal indentkeys = ! ,o ,O
21
24
22
- " NOTE: To debug this code, make sure to "set debug+=msg" otherwise errors
23
- " will occur silently.
24
-
25
25
if ! exists (' g:clojure_fuzzy_indent_patterns' )
26
26
let g: clojure_fuzzy_indent_patterns = [
27
27
\ ' ^with-\%(meta\|in-str\|out-str\|loading-context\)\@!' ,
@@ -30,41 +30,48 @@ if !exists('g:clojure_fuzzy_indent_patterns')
30
30
\ ]
31
31
endif
32
32
33
+ " TODO: are all these options needed or relevant? Use "lispwords" instead?
34
+ " Defaults copied from: https://github.com/clojure-emacs/clojure-mode/blob/0e62583b5198f71856e4d7b80e1099789d47f2ed/clojure-mode.el#L1800-L1875
33
35
if ! exists (' g:clojure_indent_rules' )
34
- " Defaults copied from: https://github.com/clojure-emacs/clojure-mode/blob/0e62583b5198f71856e4d7b80e1099789d47f2ed/clojure-mode.el#L1800-L1875
35
36
let g: clojure_indent_rules = {
36
37
\ ' ns' : 1 ,
37
- \ ' fn' : 1 , ' def' : 1 , ' defn' : 1 , ' bound-fn' : 1 ,
38
+ \ ' fn' : 1 , ' def' : 1 , ' defn' : 1 , ' bound-fn' : 1 , ' fdef' : 1 ,
39
+ \ ' let' : 1 , ' binding' : 1 , ' defmethod' : 1 ,
38
40
\ ' if' : 1 , ' if-not' : 1 , ' if-some' : 1 , ' if-let' : 1 ,
39
41
\ ' when' : 1 , ' when-not' : 1 , ' when-some' : 1 , ' when-let' : 1 , ' when-first' : 1 ,
40
42
\ ' case' : 1 , ' cond' : 0 , ' cond->' : 1 , ' cond->>' : 1 , ' condp' : 2 ,
41
43
\ ' while' : 1 , ' loop' : 1 , ' for' : 1 , ' doseq' : 1 , ' dotimes' : 1 ,
42
44
\ ' do' : 0 , ' doto' : 1 , ' comment' : 0 , ' as->' : 2 ,
43
45
\ ' delay' : 0 , ' future' : 0 , ' locking' : 1 ,
44
- \ ' fdef' : 1 ,
45
- \ ' extend' : 1 ,
46
46
\ ' try' : 0 , ' catch' : 2 , ' finally' : 0 ,
47
- \ ' let' : 1 , ' binding' : 1 ,
48
- \ ' defmethod' : 1 ,
49
- \ ' this-as' : 1 ,
50
- \ ' deftest' : 1 , ' testing' : 1 , ' use-fixtures' : 1 , ' are' : 2 ,
51
- \ ' alt!' : 0 , ' alt!!' : 0 , ' go' : 0 , ' go-loop' : 1 , ' thread' : 0 ,
52
- \ ' run' : 1 , ' run*' : 1 , ' fresh' : 1
47
+ \ ' reify' : 1 , ' proxy' : 2 , ' defrecord' : 2 , ' defprotocol' : 1 , ' definterface' : 1 ,
48
+ \ ' extend' : 1 , ' extend-protocol' : 1 , ' extend-type' : 1
53
49
\ }
54
-
55
- " (letfn '(1 ((:defn)) nil))
56
- " (proxy '(2 nil nil (:defn)))
57
- " (reify '(:defn (1)))
58
- " (deftype '(2 nil nil (:defn)))
59
- " (defrecord '(2 nil nil (:defn)))
60
- " (defprotocol '(1 (:defn)))
61
- " (definterface '(1 (:defn)))
62
- " (extend-protocol '(1 :defn))
63
- " (extend-type '(1 :defn))
64
- " (specify '(1 :defn)) ; ClojureScript
65
- " (specify! '(1 :defn)) ; ClojureScript
66
- " (this-as 1) ; ClojureScript
67
- " clojure.test, core.async, core.logic
50
+ " (letfn) (1 ((:defn)) nil)
51
+ " (reify) (:defn (1))
52
+ " (deftype defrecord proxy) (2 nil nil (:defn))
53
+ " (defprotocol definterface extend-protocol extend-type) (1 (:defn))
54
+
55
+ " ClojureScript
56
+ call extend (g: clojure_indent_rules , {
57
+ \ ' this-as' : 1 , ' specify' : 1 , ' specify!' : 1
58
+ \ })
59
+ " (specify specify!) (1 :defn)
60
+
61
+ " clojure.test
62
+ call extend (g: clojure_indent_rules , {
63
+ \ ' deftest' : 1 , ' testing' : 1 , ' use-fixtures' : 1 , ' are' : 2
64
+ \ })
65
+
66
+ " core.async
67
+ call extend (g: clojure_indent_rules , {
68
+ \ ' alt!' : 0 , ' alt!!' : 0 , ' go' : 0 , ' go-loop' : 1 , ' thread' : 0
69
+ \ })
70
+
71
+ " core.logic
72
+ call extend (g: clojure_indent_rules , {
73
+ \ ' run' : 1 , ' run*' : 1 , ' fresh' : 1
74
+ \ })
68
75
endif
69
76
70
77
" Get the value of a configuration option.
0 commit comments