Skip to content

Commit 33b1a3a

Browse files
committed
Change vim-top-cluster to a function
1 parent 131a2b1 commit 33b1a3a

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

clj/src/vim_clojure_static/generate.clj

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@
6767
:else (conj v (str x))))
6868
[] coll))
6969

70+
(defn vim-top-cluster
71+
"Generate a Vimscript literal `syntax cluster` statement for all top-level
72+
syntax groups in the given syntax buffer."
73+
[syntax-buf]
74+
(->> syntax-buf
75+
(re-seq #"syntax\s+(?:keyword|match|region)\s+(\S+)(?!.*\bcontained\b)")
76+
(map peek)
77+
sort
78+
distinct
79+
(string/join \,)
80+
(format "syntax cluster clojureTop contains=@Spell,%s\n")))
81+
7082
;;
7183
;; Definitions
7284
;;
@@ -272,17 +284,6 @@
272284
"Vimscript literal `setlocal lispwords=` statement."
273285
(str "setlocal lispwords=" (string/join \, (sort lispwords)) "\n"))
274286

275-
(def vim-top-cluster
276-
"Vimscript literal `syntax cluster` for all top-level syntax groups."
277-
(->> "../syntax/clojure.vim"
278-
slurp
279-
(re-seq #"syntax\s+(?:keyword|match|region)\s+(\S+)(?!.*\bcontained\b)")
280-
(map peek)
281-
sort
282-
distinct
283-
(string/join \,)
284-
(format "syntax cluster clojureTop contains=@Spell,%s\n")))
285-
286287
(comment
287288
;; Generate the vim literal definitions for pasting into the runtime files.
288289
(spit "tmp/clojure-defs.vim"
@@ -300,7 +301,7 @@
300301
vim-unicode-block-char-classes
301302
\newline
302303
generation-comment
303-
vim-top-cluster
304+
(vim-top-cluster (slurp "../syntax/clojure.vim"))
304305
\newline
305306
generation-comment
306307
vim-lispwords

0 commit comments

Comments
 (0)