vim-php-refactoring


Ⅰ. 插件描述

PHP Refactoring support for VIM

Ⅱ. 基本信息

创建日期:  2013-12-10
使用用户:  25
Github星:  65
插件作者:  Vim PHP

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

PHP Refactoring Support for VIM

PHP Refactoring support for VIM using [php-refactorings-browser https://github.com/QafooLabs/php-refactoring-browser]

Installation

Using Vundle

Add Bundle 'vim-php/vim-php-refactoring' to your .vimrc file and then:

  • either run :BundleInstall within vim
  • or run vim +BundleInstall +qall from your shell

Configuring

You also need to Download refactor.phar from
https://github.com/QafooLabs/php-refactoring-browser and add

let g:php_refactor_command='php /path/to/refactor.phar'

to your .vimrc file.

Usage

When inside a PHP file the following mappings work

EXTRACT METHOD

Go into visual mode and select the code you want to extract to a new
method the press <Leader>rem

You will be prompted for the name of the new method.

If you want to bypass the menu:

vnoremap <leader>em :call PhpRefactorExtractMethodDirectly()<cr>

RENAME LOCAL VARIABLE

In normal mode move the cursor so it's inside the name of the variable
which you want to rename. Press <Leader>rlv

You will be prompted for the new name of the variable.

LOCAL VARIABLE TO INSTANCE VARIABLE

In normal mode move the cursor so it's inside the name of the variable
which you want to rename. Press <Leader>rli

OPTIMIZE USE

Simple press <Leader>rou to run the optimize use refactoring.

添加新评论