vim-scripts/tComment

语言: Vim script

git: https://github.com/vim-scripts/tComment

一个可扩展的通用注释插件,它还可以处理嵌入的文件类型
An extensible & universal comment plugin that also handles embedded filetypes
README.md (中文)

这是http://www.vim.org/scripts/script.php?script_id=1173的一面镜子

:TComment就像切换一样工作,即它会注释掉那些文本 包含未注释的行,它将取消注释 评论文本(即不包含未注释行的文本)。

如果正确定义了文件类型,:TComment将找出哪个 要根据&commentstring或&comments的值使用注释字符串。 对于某些文件类型,明确定义了注释定义。您可以 | tcomment#DefineType()|添加自己的定义。

TComment知道如何处理不同文件类型的嵌入代码 比主文件类型,例如vim脚本中的ruby / python / perl区域,HTML或 php代码中的JavaScript等

作为运算符(可以通过g:tcommentMapLeaderOp1自定义前缀 和g:tcommentMapLeaderOp2):

gc{motion}   :: Toggle comments (for small comments within one line 
                the &filetype_inline style will be used, if 
                defined)
gcc          :: Toggle comment for the current line
gC{motion}   :: Comment region
gCc          :: Comment the current line

主键映射:

<c-_><c-_>   :: :TComment
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
<c-_>b       :: :TCommentBlock
<c-_>a       :: :TCommentAs <QUERY COMMENT TYPE>
<c-_>n       :: :TCommentAs &filetype <QUERY COUNT>
<c-_>s       :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
<c-_>i       :: :TCommentInline
<c-_>r       :: :TCommentRight
<c-_>p       :: Comment the current inner paragraph

还有一组次要的关键地图,其中_为领导者(更多 最好在终端上)。

完整文档可在此处获得: http://github.com/tomtom/tcomment_vim/blob/master/doc/tcomment.txt

演示: http://vimsomnia.blogspot.com/2010/11/tcomment-vim-plugin.html

也可以通过git获得 http://github.com/tomtom/tcomment_vim

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1173

:TComment works like a toggle, i.e., it will comment out text that
contains uncommented lines, and it will uncomment already
commented text (i.e. text that contains no uncommented lines).

If the file-type is properly defined, :TComment will figure out which
comment string to use based on the values of &commentstring or &comments.
For some filetypes, the comment definition is explicitly defined. You can
|tcomment#DefineType()| to add your own definitions.

TComment knows how to deal with embedded code of a different filetype
than the main filetype, e.g., ruby/python/perl regions in vim scripts, HTML or
JavaScript in php code etc.

As operator (the prefix can be customized via g:tcommentMapLeaderOp1
and g:tcommentMapLeaderOp2):

gc{motion}   :: Toggle comments (for small comments within one line 
                the &filetype_inline style will be used, if 
                defined)
gcc          :: Toggle comment for the current line
gC{motion}   :: Comment region
gCc          :: Comment the current line

Primary key maps:

<c-_><c-_>   :: :TComment
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
<c-_>b       :: :TCommentBlock
<c-_>a       :: :TCommentAs <QUERY COMMENT TYPE>
<c-_>n       :: :TCommentAs &filetype <QUERY COUNT>
<c-_>s       :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
<c-_>i       :: :TCommentInline
<c-_>r       :: :TCommentRight
<c-_>p       :: Comment the current inner paragraph

There is also a secondary set of key maps with _ as leader (more
preferable on terminals).

The full documentation is available here:
http://github.com/tomtom/tcomment_vim/blob/master/doc/tcomment.txt

Demo:
http://vimsomnia.blogspot.com/2010/11/tcomment-vim-plugin.html

Also available via git
http://github.com/tomtom/tcomment_vim