vim-voicecode


Ⅰ. 插件描述

Vim plugin that lets VoiceCode remote-control the Vim editor

Ⅱ. 基本信息

创建日期:  2015-12-21
使用用户:  1
Github星:  5
插件作者:  VoiceCode

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# vim-voicecode

A Vim plug-in that allows interfacing with VoiceCode by communicating the
current vim mode to the VoiceCode api. This plug-in works in conjunction with
vim to extend the stock VoiceCode commands
to work consistently inside terminal Vim.

Installation

Use your plugin manager of choice.

  • Pathogen

    • git clone https://github.com/VoiceCode/vim-voicecode ~/.vim/bundle/vim-voicecode
  • Vundle

    • Add Bundle 'https://github.com/VoiceCode/vim-voicecode' to .vimrc
    • Run :BundleInstall
  • NeoBundle

    • Add NeoBundle 'https://github.com/VoiceCode/vim-voicecode' to .vimrc
    • Run :NeoBundleInstall
  • vim-plug

    • Add Plug 'https://github.com/VoiceCode/vim-voicecode' to .vimrc
    • Run :PlugInstall

Known Issues

The plug-in works by sending events to VoiceCode whenever a Vim buffer is
opened/closed or you enter/exit insert mode. If you are inside vim and switch
applications, when you switch back to vim it's possible that VoiceCode's state may not
be in sync and won't be reset until you enter/exit insert mode again.

Adding Custom Commands

This plug-in sends the current vim mode as well as the current file type/extension
to VoiceCode.

Below is an example of a file type aware function definition command. The command
will insert the desired function declaration depending upon what language we
are using.

vim = Packages.get('vim');

MyCoolVimPackage.commands({
  'my-command': {
    spoken: 'deaf',
    description: "File type aware function definition",
    tags: ["text"],
    grammarType: 'textCapture',
    scope: 'vim:terminal', // important
    action: function(input) {
      if (vim.state.mode === "normal") { this.key("I"); }
      if (vim.state.fileType === "python") {
        this.string("def ");
        if (input) {
          this.string(Transforms.snake(input));
          this.string("():");
          this.key("Left");
          this.key("Left");
        }
      } else if (vim.state.fileType === "clojure") {
        this.string("(defn ");
        if (input) {
          this.string(Transforms.spine(input));
          this.string(")");
          this.key("Left");
        }
      }
    }
  }
});

添加新评论