wiki:VimInterface

Version 1 (modified by manualwiki, 13 years ago) (diff)

--

The command interface provides the use of ReactorErl? in VIM.

In VIM, a VIM plugin has to be made to create a user interface which contains the menus of RefactorErl? as well as those commands with the help of which the refactorings can be run and the files loaded in the system can be handled.

Installation

To install the plugin, you can copy it to the vim plugin directory. For global installation, the plugin directory is usually located in /usr/share/vim/vimVersion/plugin, for local install copy the plugin to HOME/.vim/plugin directory.

Then you should modify the refpath variable in the script to the installation directory of RefactorErl?.

Since VIM interface is based on CLI it should be properly configured. For proper configuration of CLI, see the corresponding section.

Since the VIM interface does not cover all features of the tool, it is a good idea to use another interface, e.g. the Erlang shell interface (ri).

VIM can be used both in command line and in graphical environment. The VIM plugin of RefactorErl? supports both of them. In the graphical front-end (Fig. \ref{vim-fig}) every command can be reached from the RefactorErl? menu. The features are grouped to be easily found. These groups and the most important tasks can be found in the following, and the second column of the table shows the corresponding command to be used in non-graphical mode.

Menu item Command
Server ---
Files ---
Undo (One step only) Refundo
Semantic query Refsq
Function ---
Introduce/Eliminate? ---
Move to another module ---
Renaming ---
Upgrade ---
Help Refh

Server submenu

The server can be started and stopped by the menus and commands shown in Table \ref{vim-server-groups}. If the RefactorErl? cannot be started an error message is shown in command buffer.

Menu item Command
Server ---
-> Start RefSta
-> Stop RefSto

Files submenu

Features dealing with files can be found in Table \ref{vim-files-groups}. \emph{Draw graph} makes a graphical representation of the database by creating a \emph{dot} file.

Menu item Command
Files ---
-> Add file Refa
-> Drop file Refd
-> Show database Refls
-> Draw Graph Refgraph

Function submenu

This submenu contains only the \emph{Reorder function parameter} refactoring, this menu group has been created for future use. Menu item and the command can be found in Table \ref{vim-func-groups}.

Menu item Command
Function ---
-> Reorder function parameter Refof

Introduce/Eliminate? submenu

In this submenu (shown in Table \ref{vim-elim-groups}.) the refactorings concerning introduction and elimination of certain language constructs can be found.

Menu item Command
Introduce/Eliminate? ---
-> Eliminate function call Refef
-> Eliminate macro substitution Refem
-> Eliminate variable Refev
-> Eliminate fun expression Refeu
-> Introduce function Refif
-> Introduce import Refii
-> Introduce record Refir
-> Introduce variable Refiv
-> Introduce process Reffp
-> Introduce function argument Refia
-> Introduce tuple Reftf
-> Transform list comprehension Reftl

Move to another module submenu

In this menu item the refactorings concerning moving can be found. These are shown in Table \ref{vim-move-groups}. The modules changed by the refactoring are not opened.

Menu item Command
Move to another module ---
-> Move function Refmf
-> Move macro Refmm
-> Move record Refmr

Upgrade submenu

The upgrade regexp refactoring can be found in the Upgrade submenu (shown in Table \ref{vim-upgrade-groups}). This menu has been created for future use, too.

Menu item Command
Upgrade ---
-> Upgrade regexp interface Refuir

Renaming submenu

The universal renamer and the type specific renamer refactorings are shown in Table \ref{vim-ren-groups}.

Menu item Command
Renaming ---
-> Universal renamer Refr
-> Rename function Refrf
-> Rename header Refrh
-> Rename macro Refrc
-> Rename module Refrm
-> Rename record Refrrd
-> Rename record field Refrrf
-> Rename variable Refrv

Position based refactorings

Refactorings need either a single position or a range as a subject. In VIM, a range can be selected only in Visual mode, but you cannot execute a single statement while Visual mode is active, so you have to save the boundaries of the selection by pressing F2. Then you can run the range based refactorings. Position based refactorings are not affected by any saved ranges, they determine the actual cursor position every time a refactoring is started.

Interaction

If any of the given argument is missing or incorrect the interface provides user interaction to collect required data. To cancel an ongoing interaction you should use a blank answer.

Semantic queries

Semantic queries are fully supported in VIM interface (shown in Table \ref{vim-main-groups}). VIM does not support links to different sources, but the path and the location are listed after all entity in the result. This filepath can be copied and pasted after an open command (:e +line filepath ).

Attachments (2)

Download all attachments as: .zip