| 1 | The command interface provides the use of ReactorErl in VIM. |
| 2 | |
| 3 | In VIM, a VIM plugin has to be made to create a user |
| 4 | interface which contains the menus of RefactorErl as well as |
| 5 | those commands with the help of which the refactorings can be run |
| 6 | and the files loaded in the system can be handled. |
| 7 | |
| 8 | === Installation === |
| 9 | |
| 10 | To install the plugin, you can copy it to the vim plugin |
| 11 | directory. For global installation, the plugin directory is |
| 12 | usually located in {{{/usr/share/vim/vimVersion/plugin}}}, for local install |
| 13 | copy the plugin to {{{HOME/.vim/plugin}}} |
| 14 | directory. |
| 15 | |
| 16 | Then you should modify the {{{refpath}}} variable in the script to |
| 17 | the installation directory of RefactorErl. |
| 18 | |
| 19 | Since VIM interface is based on CLI it should be properly |
| 20 | configured. For proper configuration of CLI, see the corresponding |
| 21 | section. |
| 22 | |
| 23 | Since the VIM interface does not cover all features of the tool, it is |
| 24 | a good idea to use another interface, e.g. the Erlang shell interface |
| 25 | ({{{ri}}}). |
| 26 | |
| 27 | === Menu and command structure === |
| 28 | |
| 29 | VIM can be used both in command line and in graphical environment. The |
| 30 | VIM plugin of RefactorErl supports both of them. In the graphical |
| 31 | front-end (Fig. \ref{vim-fig}) every command can be reached from the |
| 32 | RefactorErl menu. The features are grouped to be easily found. These |
| 33 | groups and the most important tasks can be found in the following, and the second column of the table shows the |
| 34 | corresponding command to be used in non-graphical mode. |
| 35 | || Menu item || Command || |
| 36 | || Server || --- || |
| 37 | || Files || --- || |
| 38 | || Undo (One step only) || {{{Refundo}}} || |
| 39 | || Semantic query || {{{Refsq}}} || |
| 40 | || Function || --- || |
| 41 | || Introduce/Eliminate || --- || |
| 42 | || Move to another module || --- || |
| 43 | || Renaming || --- || |
| 44 | || Upgrade || --- || |
| 45 | || Help || {{{Refh}}} || |
| 46 | |
| 47 | ==== Server submenu ==== |
| 48 | The server can be started and stopped by the menus and commands shown |
| 49 | in Table \ref{vim-server-groups}. If the RefactorErl cannot be started |
| 50 | an error message is shown in command buffer. |
| 51 | |
| 52 | |
| 53 | || Menu item || Command|| |
| 54 | || Server || --- || |
| 55 | || -> Start || {{{RefSta}}} || |
| 56 | || -> Stop || {{{RefSto}}} || |
| 57 | |
| 58 | |
| 59 | ==== Files submenu ==== |
| 60 | Features dealing with files can be found in Table |
| 61 | \ref{vim-files-groups}. \emph{Draw graph} makes a graphical |
| 62 | representation of the database by creating a \emph{dot} file. |
| 63 | |
| 64 | || Menu item || Command|| |
| 65 | || Files || --- || |
| 66 | || -> Add file|| {{{Refa}}} || |
| 67 | || -> Drop file|| {{{Refd}}} || |
| 68 | || -> Show database || {{{Refls}}} || |
| 69 | || -> Draw Graph || {{{Refgraph}}} || |
| 70 | |
| 71 | ==== Function submenu ==== |
| 72 | This submenu contains only the \emph{Reorder function parameter} |
| 73 | refactoring, this menu group has been created for future use. Menu |
| 74 | item and the command can be found in Table \ref{vim-func-groups}. |
| 75 | |
| 76 | || Menu item || Command|| |
| 77 | || Function || --- || |
| 78 | || -> Reorder function parameter || {{{Refof}}} || |
| 79 | |
| 80 | ==== Introduce/Eliminate submenu ==== |
| 81 | In this submenu (shown in Table \ref{vim-elim-groups}.) the |
| 82 | refactorings concerning introduction and elimination of certain |
| 83 | language constructs can be found. |
| 84 | |
| 85 | || Menu item || Command|| |
| 86 | || Introduce/Eliminate || --- || |
| 87 | || -> Eliminate function call || {{{Refef}}} || |
| 88 | || -> Eliminate macro substitution || {{{Refem}}} || |
| 89 | || -> Eliminate variable || {{{Refev}}} || |
| 90 | || -> Eliminate fun expression || {{{Refeu}}} || |
| 91 | || -> Introduce function || {{{Refif}}} || |
| 92 | || -> Introduce import || {{{Refii}}} || |
| 93 | || -> Introduce record || {{{Refir}}} || |
| 94 | || -> Introduce variable || {{{Refiv}}} || |
| 95 | || -> Introduce process || {{{Reffp}}} || |
| 96 | || -> Introduce function argument || {{{Refia}}} || |
| 97 | || -> Introduce tuple || {{{Reftf}}} || |
| 98 | || -> Transform list comprehension || {{{Reftl}}} || |
| 99 | |
| 100 | ==== Move to another module submenu ==== |
| 101 | In this menu item the refactorings concerning moving can be |
| 102 | found. These are shown in Table \ref{vim-move-groups}. The modules |
| 103 | changed by the refactoring are not opened. |
| 104 | |
| 105 | |
| 106 | || Menu item || Command|| |
| 107 | || Move to another module || --- || |
| 108 | || -> Move function || {{{Refmf}}} || |
| 109 | || -> Move macro || {{{Refmm}}} || |
| 110 | || -> Move record || {{{Refmr}}} || |
| 111 | |
| 112 | ==== Upgrade submenu ==== |
| 113 | The upgrade regexp refactoring can be found in the Upgrade submenu |
| 114 | (shown in Table \ref{vim-upgrade-groups}). This menu has been created |
| 115 | for future use, too. |
| 116 | |
| 117 | |
| 118 | || Menu item || Command|| |
| 119 | || Upgrade || --- || |
| 120 | || -> Upgrade regexp interface || {{{Refuir}}} || |
| 121 | |
| 122 | |
| 123 | ==== Renaming submenu ==== |
| 124 | The universal renamer and the type specific renamer refactorings are |
| 125 | shown in Table \ref{vim-ren-groups}. |
| 126 | |
| 127 | |
| 128 | || Menu item || Command|| |
| 129 | || Renaming || --- || |
| 130 | || -> Universal renamer || {{{Refr}}} || |
| 131 | || -> Rename function || {{{Refrf}}} || |
| 132 | || -> Rename header || {{{Refrh}}} || |
| 133 | || -> Rename macro || {{{Refrc}}} || |
| 134 | || -> Rename module || {{{Refrm}}} || |
| 135 | || -> Rename record || {{{Refrrd}}} || |
| 136 | || -> Rename record field || {{{Refrrf}}} || |
| 137 | || -> Rename variable || {{{Refrv}}} || |
| 138 | |
| 139 | === Position based refactorings === |
| 140 | Refactorings need either a single position or a range as a subject. In |
| 141 | VIM, a range can be selected only in {{{Visual mode}}}, but you |
| 142 | cannot execute a single statement while {{{Visual mode}}} is |
| 143 | active, so you have to save the boundaries of the selection by |
| 144 | pressing F2. Then you can run the range based refactorings. Position |
| 145 | based refactorings are not affected by any saved ranges, they |
| 146 | determine the actual cursor position every time a refactoring is |
| 147 | started. |
| 148 | |
| 149 | === Interaction === |
| 150 | If any of the given argument is missing or incorrect the interface |
| 151 | provides user interaction to collect required data. To cancel an |
| 152 | ongoing interaction you should use a blank answer. |
| 153 | |
| 154 | === Semantic queries === |
| 155 | Semantic queries are fully supported in VIM interface (shown in |
| 156 | Table \ref{vim-main-groups}). VIM does not support links to different |
| 157 | sources, but the path and the location are listed after all entity in |
| 158 | the result. This filepath can be copied and pasted after an open |
| 159 | command ({{{:e +line filepath }}}). |
| 160 | |