vim-movar


Ⅰ. 插件描述

Custom vim movements for selecting variables in PHP and Ruby

Ⅱ. 基本信息

创建日期:  2013-01-30
使用用户:  11
Github星:  27
插件作者:  Rob Miller

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# movar

movar is a Vim plugin that adds a couple of movements that make working
with variables easier.

av: around variable

movar adds the movement av — "around variable" — which makes it easy
to yank, change, or delete variables in one fell swoop.

It covers a lot of use cases that previously would require several
different movements. For example, with the cursor anywhere in the
variable in the following examples, cav would always select the
variable and only the variable:

if ( $_SERVER['REQUEST_URI'] === '/foo' ) {

(rather than ciW)

if ( isset($_SERVER['REMOTE_ADDR']) ) {

(rather than ci()

As well as some cases not easily covered by existing movements, like:

$foo->bar("baz")

...where no single movement would allow you to select $foo->bar from
within the variable.

 iv: inner variable

For variables that have sigil characters — e.g. Ruby, which uses @ for
instance variables and $ for global variables — movar adds another
movement: iv, which matches the name of the variable but leaves the
sigil intact. So, if you have:

@foo['bar']

…then calling civ from anywhere within the variable will change
foo['bar'] and leave the @ in place.

 Language support

At the moment, movar supports PHP, Javascript, and Ruby, but it should
be relatively straightforward to add new rules for different languages
in the future.

添加新评论