vimCU


Ⅰ. 插件描述

comment/uncomment functionalities for every language

Ⅱ. 基本信息

创建日期:  2005-02-19
使用用户:  3
Github星:  1
插件作者:  Stefano Zacchiroli

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/vimcu'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/vimcu'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/vimcu'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/vimCU

Ⅳ. 文档说明

vimCU is a set of ViM functions that you can use to customize your ViM editor to comment/uncomment source code of every language you like.

Comment key binding defaults to ",#" while uncomment key binding to ",3" (mnemonic: same key as comment, but without shift). In command mode the current line will be commented/uncommented, in visual mode all selected lines will.

In order to support commenting in the language of your choice you've to define how comments are handled in that language defining the following local variables:

  • variable "b:CommentType". A string formed using "s" and/or "m" chars; "s" means that your language supports single line comment like, e.g., bash script, perl or similar, that are comments formed adding something at the beginning and at the end of a line; "m" means that your language supports multi line comment like, e.g. ANSI C, OCaml, or similar, that are comments that extends from a character set to another character set; "ms" or "sm" mean that your language supports both kinds of comments like, e.g., C++.
  • variables: "b:beginOfCommentSingle", "b:endOfCommentSingle". Strings that are used to begin and end a single line comment. These strings are added at the begin and at the end of the line you want to commend.
  • variables: "b:beginOfCommentMulti", "b:endOfCommentMulti". Strings that are used to begin and end a multi line comment. These strings are added before and after the line(s) you are commenting on a line by themeselves.

For example, in order to support C++, just add to your ~/.vim/ftplugin/cpp.vim the following lines:
      let b:CommentType = "ms"
      let b:beginOfCommentSingle = "// "
      let b:endOfCommentSingle = ""
      let b:beginOfCommentMulti = "/*"
      let b:endOfCommentMulti = "*/"

添加新评论