2017-09-06 96 views
2

在clojure中,您可以使用#_来注释掉下一个表单。例如在vim中突出显示clojure的评论宏的形式

#_(foo 2 3 4) 
#_foo 
#_{:a '(1 2 3) :b [1 2 3]} 

将注释掉上面的列表,符号和地图。和Emacs一样,我期望,并希望表单能够获得注释的语法突出显示。

在vim中,注释表单没有默认的语法高亮显示。我也没有找到任何这样做的插件。有没有人试图配置这个?感谢任何帮助。

+0

为什么不会用分号注释?这对我来说适用于Vim,甚至可以通过插件来支持。 –

+1

因为你不能使用分号注释表单而不会破坏paranthenis的对称性 – lsund

回答

0

vim-clojure-static插件未启用使用#_表单的注释,因为它禁用了注释掉块的REPL集成(请参阅https://github.com/guns/vim-clojure-static/issues/60)。

在这个问题,解决这个(上面链接)@guns提供以下除了语法文件,以使的意见高亮:

" WARNING: This code has the following KNOWN deficiencies: " " · Consecutive #_ macros are not matched correctly: " (list #_#_ 1 2 3) ;; => (3) " · Bracket character literals within #_ comment regions break syntax: " #_[\a \[ \] \b] ;; broken " · Compound forms preceded by reader metacharacters are unmatched: " #_'(α β γ) ;; broken " · Atomic forms preceded by reader metacharacters + whitespace are unmatched: " #_' foo ;; broken " syntax match clojureCommentAtom /\v#_[ \t\r\n]*[^()\[\]{} \t\r\n]+/ syntax region clojureCommentListContained start=/(/ end=/)/ contains=clojureCommentListContained,clojureCommentVectorContained,clojureCommentMapContained,clojureCommentStringContained contained syntax region clojureCommentVectorContained start=/\[/ end=/]/ contains=clojureCommentListContained,clojureCommentVectorContained,clojureCommentMapContained,clojureCommentStringContained contained syntax region clojureCommentMapContained start=/{/ end=/}/ contains=clojureCommentListContained,clojureCommentVectorContained,clojureCommentMapContained,clojureCommentStringContained contained syntax region clojureCommentStringContained start=/"/ skip=/\v\\\\|\\"/ end=/"/ contained syntax region clojureCommentList matchgroup=clojureCommentDelimiter start=/\v#_[ \t\r\n]*\(/ end=/)/ contains=clojureCommentListContained,clojureCommentVectorContained,clojureCommentMapContained,clojureCommentStringContained syntax region clojureCommentVector matchgroup=clojureCommentDelimiter start=/\v#_[ \t\r\n]*\[/ end=/]/ contains=clojureCommentListContained,clojureCommentVectorContained,clojureCommentMapContained,clojureCommentStringContained syntax region clojureCommentMap matchgroup=clojureCommentDelimiter start=/\v#_[ \t\r\n]*\{/ end=/}/ contains=clojureCommentListContained,clojureCommentVectorContained,clojureCommentMapContained,clojureCommentStringContained syntax region clojureCommentString matchgroup=clojureCommentDelimiter start=/\v#_[ \t\r\n]*"/ skip=/\v\\\\|\\"/ end=/"/ highlight link clojureCommentDelimiter clojureComment highlight link clojureCommentAtom clojureComment highlight link clojureCommentListContained clojureComment highlight link clojureCommentVectorContained clojureComment highlight link clojureCommentMapContained clojureComment highlight link clojureCommentStringContained clojureComment highlight link clojureCommentList clojureComment highlight link clojureCommentVector clojureComment highlight link clojureCommentMap clojureComment highlight link clojureCommentString clojureComment

我个人使用Spacemacs(通常Emacs的Vim绑定和电池包括)与Clojure layer,并有评论和REPL整合工作正常,但我相信你知道这一点。