vim-extract-variable


Ⅰ. 插件描述

Vim plugin to extract an expression to a variable

Ⅱ. 基本信息

创建日期:  2017-11-10
使用用户:  5
Github星:  17
插件作者:  Franco Victorio

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# vim-extract-variable

Extract an expression to a variable.

vim-extract-variable demo

Installation

Use one of the hundred of methods that exist to install a vim plugin. I recommend vim-plug:

Plug 'fvictorio/vim-extract-variable'

Usage

A normal and visual mapping is set: <leader>ev. If you use it in visual mode, it extracts the selected text to a variable. The name of the variable will be prompted to you. If you use it in normal mode, the text between parentheses is used.

The declaration is created in the previous line, using O, so it should preserve the indentation if you have autoindent on.

Supported languages

The following languages are supported:

LanguageResult
Elixirfoo = 42
Gofoo := 42
JavaScriptconst foo = 42
TypeScriptconst foo = 42
Pythonfoo = 42
Rubyfoo = 42

添加新评论