Ⅰ. 插件描述
Simple, flexibel, language-independent mappings to de-/commentifyⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/togglecomment'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/togglecomment'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/togglecomment'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/ToggleComment
Ⅳ. 文档说明
This utility draws heavily from vimtip #271 and additional note 2002-07-06.
Yet it's different in one or more aspects from other tips and scripts I'm
aware off.
Features:
- de-/commtify lines in normal mode (with count) and visual mode
- use the same keys for commenting and decommenting
- language independent, you define different mappings for various languages
and/or one comment-command for different filetypes - simple and flexibel, to change the comment characters from '#' to '# ' e.g.,
just change a mapping in your .vimrc, not the script - comment-style: comments are indented like the uncommented line
- no hlsearch problem, last search pattern and .-command are preserved
- inserted comment characters are protected from further expansion
- might be adapted to other comment styles (first column comments, ...)
Example:
Commented text looks like this:
#if uncommented:
/ comment the line /
<!-- else: -->
// uncomment the
// lines
no comment
You would put or remove this comments (cursor on the first line), by typing:
,# ,* ,< 2,/