|
74 | 74 | (->> syntax-buf |
75 | 75 | (re-seq #"syntax\s+(?:keyword|match|region)\s+(\S+)(?!.*\bcontained\b)") |
76 | 76 | (map peek) |
| 77 | + (concat (map first keyword-groups)) |
77 | 78 | sort |
78 | 79 | distinct |
79 | 80 | (string/join \,) |
|
100 | 101 | (def keyword-groups |
101 | 102 | "Special forms, constants, and every public var in clojure.core listed by |
102 | 103 | syntax group suffix." |
103 | | - (let [builtins [["Constant" '#{nil}] |
104 | | - ["Boolean" '#{true false}] |
105 | | - ["Special" special-forms] |
| 104 | + (let [builtins [["clojureConstant" '#{nil}] |
| 105 | + ["clojureBoolean" '#{true false}] |
| 106 | + ["clojureSpecial" special-forms] |
106 | 107 | ;; These are duplicates from special-forms |
107 | | - ["Exception" '#{throw try catch finally}] |
108 | | - ["Cond" '#{case cond cond-> cond->> condp if-let if-not |
109 | | - if-some when when-first when-let when-not |
110 | | - when-some}] |
| 108 | + ["clojureException" '#{throw try catch finally}] |
| 109 | + ["clojureCond" '#{case cond cond-> cond->> condp if-let |
| 110 | + if-not if-some when when-first when-let |
| 111 | + when-not when-some}] |
111 | 112 | ;; Imperative looping constructs (not sequence functions) |
112 | | - ["Repeat" '#{doseq dotimes while}]] |
| 113 | + ["clojureRepeat" '#{doseq dotimes while}]] |
113 | 114 | coresyms (set/difference (set (keys (ns-publics 'clojure.core))) |
114 | 115 | (set (mapcat peek builtins))) |
115 | | - group-preds [["Define" #(re-seq #"\Adef(?!ault)" (str %))] |
116 | | - ["Macro" #(:macro (meta (ns-resolve 'clojure.core %)))] |
117 | | - ["Func" #(fn-var? (ns-resolve 'clojure.core %))] |
118 | | - ["Variable" identity]]] |
| 116 | + group-preds [["clojureDefine" #(re-seq #"\Adef(?!ault)" (str %))] |
| 117 | + ["clojureMacro" #(:macro (meta (ns-resolve 'clojure.core %)))] |
| 118 | + ["clojureFunc" #(fn-var? (ns-resolve 'clojure.core %))] |
| 119 | + ["clojureVariable" identity]]] |
119 | 120 | (first |
120 | 121 | (reduce |
121 | 122 | (fn [[v syms] [group pred]] |
|
176 | 177 | ;; |
177 | 178 |
|
178 | 179 | (def vim-keywords |
179 | | - "Vimscript literal `syntax keyword` for important identifiers." |
| 180 | + "Vimscript literal dictionary of important identifiers." |
180 | 181 | (->> keyword-groups |
181 | 182 | (map (fn [[group keywords]] |
182 | | - (format "syntax keyword clojure%s %s\n" |
183 | | - group |
184 | | - (string/join \space (sort (map-keyword-names keywords)))))) |
185 | | - string/join)) |
| 183 | + (->> keywords |
| 184 | + map-keyword-names |
| 185 | + sort |
| 186 | + (map pr-str) |
| 187 | + (string/join \,) |
| 188 | + (format "'%s': [%s]" group)))) |
| 189 | + (string/join "\n \\ , ") |
| 190 | + (format "let s:clojure_syntax_keywords = {\n \\ %s\n \\ }\n"))) |
186 | 191 |
|
187 | 192 | (def vim-completion-words |
188 | 193 | "Vimscript literal list of words for omnifunc completion." |
189 | 194 | (->> 'clojure.core |
190 | 195 | ns-publics |
191 | 196 | keys |
192 | 197 | (concat special-forms) |
193 | | - (map #(str \" % \")) |
| 198 | + (map (comp pr-str str)) |
194 | 199 | sort |
195 | 200 | (string/join \,) |
196 | 201 | (format "let s:words = [%s]\n"))) |
|
0 commit comments