CommentAnyWay


Ⅰ. 插件描述

Vim comment plugin: supported operator/non-operator mappings, repeatable by dot-command, 300+ filetypes

Ⅱ. 基本信息

创建日期:  2009-02-25
更新日期:  2年以前
使用用户:  491
Github星:  199
插件作者:  tyru

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# Build Status

ServiceStatus
Travis CITravis CI
AppVeyorAppVeyor

Features

  • Supports 300+ filetypes (:help caw-supported-filetypes).

    • But caw.vim does not slow down your Vim startup because each comment
      string are defined at ftplugin files (after/ftplugin/<filetype>/caw.vim).
  • Supports operator keymappings (:help caw-keymappings-operator).

    • If g:caw_operator_keymappings is non-zero, all default keymappings map
      to operator keymappings.
    • If you need kana/vim-operator-user to use operator keymappings.
  • Supports also non-operator keymappings (:help caw-keymappings-non-operator).
  • Dot-repeatable if you installed kana/vim-repeat
  • The comment behavior only depends on 'filetype' by default.
    But if you have installed Shougo/context_filetype.vim, caw.vim also depends on the

filetype of the context of the current cursor location.
So you can comment/uncomment JavaScript in HTML correctly.

How it works

The below are the examples in "filetype=c".
caw.vim supports 300+ filetypes (:help caw-supported-filetypes).

Type "gci" (toggle: "gcc", uncomment: "gcui")
  before:
      "   <- inserted here"
  after:
      "   # <- inserted here"

Type "gcI" (uncomment: "gcuI")
  before:
      "   inserted the first column"
  after:
      "#    inserted the first column"

Type "gca" (uncomment: "gcua")
  before:
      "inserted after this"
  after:
      "inserted after this    # "

Type "gcw" (uncomment: "gcuw")
  before:
      "  wrap!"
  after:
      "  /* wrap! */"

Type "gcb"
  before:
      "  box!"
  after:
      "  /********/"
      "  /* box! */"
      "  /********/"

Type "gco"
  before:
      "   func1();"
  after:
      "   func1()"
      "   // "  (now cursor is at the end and entered insert-mode)

Type "gcO"
  before:
      "   func1();"
  after:
      "   // "  (now cursor is at the end and entered insert-mode)
      "   func1();"

添加新评论