openrefactory-vim


Ⅰ. 插件描述

Vim Plugin for OpenRefactory C refactoring tool

Ⅱ. 基本信息

创建日期:  2013-06-14
使用用户:  1
Github星:  3
插件作者:  Reed Allman

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# [OpenRefactory]/C (vim plugin)

About

Refactoring is hard and can be one of the reasons that users gravitate towards
using IDEs. OpenRefactory makes error-free refactoring easy for the C
programmer, all within the confines of terminal vim or gVim.

THESE ARE WAY OUT OF DATE GIFS

Easily Do a Number of Refactorings (Rename shown)

Example1

Quick Rename Refactoring

Example2

Installation

Install using [Pathogen], [Vundle], [Neobundle] or your favorite Vim package

  1. Make sure 'filetype plugin on' is in your .vimrc

Requirements

  • Vim 7.0 =<
  • Installed and configured [Java] (Mac pre-installed)
  • UNIX system (Mac / Linux) (need to test Windows)

Quick Start

Out of the box, there's only one thing you need to know: :CRefactor

Refactor

Starting :CRefactor will use your current visual selection (visual mode) or
your current cursor position to retrieve a list of all possible
transformations for that selection. Type in your desired transformation and
go.

Then:

  • Enter new parameters for refactoring
  • Look through error log (if any)
  • See diff(s) of finished file(s). :CRefactorViewChanges if there was a log
  • Decide whether you want to make changes by using :CRefactorFinish
  • Done!

Quick Rename

Pressing <Leader>h will use either the currently highlighted selection (visual
mode) or the current cursor position to start the rename transformation.

Then:

  • Enter new name for the current identifier
  • Done! (if any errors occurred, they'll be shown)

WARNING: Quick Rename doesn't allow error checking nearly as much as using
the standard refactor, i.e. there's no diff shown, so use at your own risk.

List of All Transformations

  • Rename
  • Add Local Variable
  • Add Reflexive Assignment
  • Move Expression Assignment
  • Remove Useless Expression
  • Change Integer Type
  • Add Integer Cast
  • Change Integer Type
  • Replace Arithmetic Operator

Mapping

Dont't like the default mappings? Go change them!

You can add the following lines to your .vimrc:

Start Refactoring:

let g:openrefactory_refactor='<Leader>g'

Quick Rename:

let g:openrefactory_quickrename='<Leader>h'

License

Copyright © 2013 Auburn University and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

Contributors:
Reed Allman (Auburn) - Initial API and implementation

添加新评论