vim-operator-assign


Ⅰ. 插件描述

An operator that assigns motioned text to a variable

Ⅱ. 基本信息

创建日期:  2013-07-08
使用用户:  2
Github星:  1
插件作者:  Torsten Schmits

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

vim-operator-assign

[Build Status]
(https://travis-ci.org/tek/vim-operator-assign)

Usage

map {lhs} <Plug>(operator-assign)

This operator replaces the selected text by a variable name, for which the user
is queried using input(). In the line above, the replaced code is assigned to
that variable.

Example

Given the following code:

call func(str . 'foo')

When invoking {lhs}ib with the cursor inside the parentheses and entering
bar at the prompt, the result is:

let bar = str . 'foo'
call func(bar)

Customization

Define operator#assign#ft#{&filetype}#format_assignment to override the
assignment's formatting,
operator#assign#ft#{&filetype}#format_variable_insert for the variable
replacing the selection and
operator#assign#ft#{&filetype}#indent_assignment to control the new line's
indent.

b:operator_assign_filetype Use a different filetype for the current buffer.

添加新评论