Selecting and Editing Columns on Eclipse 3.4 Ganymede
Editing text for computer programs is sometimes a difficult task. Computer programs require repetitive changes that need to be done with great precision. That is why programmers editors such as vim or emacs provide such a large number of operations, which can be used to simplify repetitive tasks.
One of the functions that some programs such as vim or emacs provide is editing by columns. With column editing, a user can simply select the same columns over a range of lines. Therefore, the selection is a rectangle, instead of a range of lines, as normally happens when we select text.
The other advantage of column selection is that one can type the same information and have it automatically repeated on all other lines that have been selected. For example, it is very common in programming that the same piece of text (a function for example) must be repeated on several lines. To do this in the column selection mode, you can just select a rectangle, and type what you want to be repeated.
Activating Column Selection in Eclipse
Eclipse doesn't come by default with column selection enabled. Although it has been a requested feature for a long time, it has not made yet to the standard distribution.
You can use activate column selection, however using an Eclipse plugin. The plugin is available for the Ganymede version of Eclipse, and can be installed from the Window-Install plugins menu option.
The plugin is called column_mode and is available in the address http://tkilla.ch/column_mode/. After you install column_mode a new tool bar icon will appear, with the name "toggle column selection mode". If you click the toggle selection button, you can now select rectangular selections, instead of normal selections.
After selecting a rectangle of text, you can delete it or edit as desired. For example, if you type something, the same text will be copied over each line of the rectangular selection.
To go back to normal selection, just click again on the toggle column selection mode, and it will return the selection mode to regular.
Conclusion
Editing rectangular selections is one of my favorite tricks when using vim. It is now also available on Eclipse as well, and it can be very handy when editing Java code. Using this plugin has saved a lot of typing in several of my projects. I believe it can help you too, if you get used to the column selection plugin.
Post a comment