Skip to content

LucHermitte/vim-refactor

Repository files navigation

vim-refactor v2.0.0 Last release Project Stats

Features

lh-refactor is a generic refactoring plugin.

So far it supports the following refactorings (v0.2.2):

  • Extract Function,
  • Extract Variable,
  • Extract Type,
  • Extract Getter & Extract Setter, (it's more a generate than an extract actually) and the following languages: C, C++, Java, Pascal, VimL.

The list of languages supported can be extended (however some refactoring work in the plugin is required to simplify that part)

The complete documentation can be browsed in the repository

Mappings

Visual-mode Mappings (not available in Select-mode)

  • <C-X>f to eXtract a Function
  • <C-X>v to eXtract a Variable
  • <C-X>t to eXtract a Type

Normal-mode Mappings

  • <C-X>g to eXtract a Getter, and <C-X>s to eXtract a Setter
  • <C-X>p and <C-X>P to Put back the definition that as been extracted

Note

The extraction refactorings don't put back anything. The position in the code where the extracted things are to be placed are left to end-user appreciation. This has to be done with <C-X>p and <C-X>P.

Installation

  • Requirements: Vim 7.+, lh-vim-lib, lh-brackets, lh-dev (and thus lh-tags), and lh-style

  • With vim-addon-manager, install lh-refactor. This is the preferred method because of the various dependencies.

    ActivateAddons lh-refactor
  • or you can clone the git repositories (expecting I haven't forgotten anything):

    git clone git@github.com:LucHermitte/lh-vim-lib.git
    git clone git@github.com:LucHermitte/lh-tags.git
    git clone git@github.com:LucHermitte/lh-dev.git
    git clone git@github.com:LucHermitte/lh-style.git
    git clone git@github.com:LucHermitte/lh-brackets.git
    git clone git@github.com:LucHermitte/vim-refactor.git
    
    # For experimental function extraction
    git clone git@github.com:LucHermitte/mu-template.git
    git clone git@github.com:tomtom/stakeholders_vim.git
    
  • or with Vundle/NeoBundle (expecting I haven't forgotten anything):

    Bundle 'LucHermitte/lh-vim-lib'
    Bundle 'LucHermitte/lh-tags'
    Bundle 'LucHermitte/lh-dev'
    Bundle 'LucHermitte/lh-style'
    Bundle 'LucHermitte/lh-brackets'
    Bundle 'LucHermitte/vim-refactor'
    
    " For experimental function extraction
    Bundle 'LucHermitte/mu-template'
    Bundle 'tomtom/stakeholders_vim'

See also