Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试制作一个评论插件,例如,当您按下/两次时,它将替换行首,例如#。
/
#
但是对于 HTML 页面,它是不同的,因为它包含标签和 javascript,我需要用/* */for javascript 块包围块,但是<!-- -->对于标签,但是我怎么知道它是 javascript 块还是只是标签?现在我只是用&filetypevariable 来判断这个,但这还不够。
/* */
<!-- -->
&filetype
有一个叫 vim 的插件TComment。这就是你想要的。
TComment
可以查看源码:https ://github.com/jmartindf/vim-tcomment