Version 4 (modified by manualwiki, 12 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 ftplugin directory. For global installation, the plugin directory is usually located in /usr/share/vim/vimVersion/ftplugin, for local install copy the plugin to HOME/.vim/ftplugin directory.
Then you should modify the refpath variable in the script to the installation directory of RefactorErl?. You should also set the other variables shown in the table.
Variable name | Value |
refpath | path to RefactorErl? |
ref_base_path | path to the tool |
ref_undo_mode | selective_undo or one_step |
ref_datadir | path to directory of data |
ref_datadir | path to directory of data |
ref_name_type | sname or name |
ref_server_name | name of the server node |
ref_db_type | the type of db backend |
Since VIM interface is based on CLI it should be properly configured. For proper configuration of CLI, see the corresponding section.
To install and use the selective undo mode, 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).
Menu and command structure
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 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 |
Undo | Refundo |
Redo | Refredo |
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 the following table. 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 the following tables. Draw graph makes a graphical representation of the database by creating a 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 Reorder function parameter refactoring, this menu group has been created for future use.
Menu item | Command |
Function | --- |
-> Reorder function parameter | Refof |
Introduce/Eliminate? submenu
In this submenu 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. 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. 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 can be found in this submenu.
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. 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)
-
gvim.png
(72.7 KB) -
added by manualwiki 13 years ago.
GVim interface
-
gvim-undo.png
(66.5 KB) -
added by manualwiki 12 years ago.
GVim undo
Download all attachments as: .zip