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.

Article created on 2009-01-04 13:47:20
coliv2 Said:
Maybe you are having an installation problem.
Comment added at 2010-01-03 15:14:01
coliv2 Said:
Please check your configuration. column_mode works really well for me.
Comment added at 2009-08-13 21:10:08
sguha Said:
This did not work. I have also installed one plug-in called columns4Eclipse, and it works fine. Not sure if that has any thing to do with it. The only problem in columns4Eclipse is that the column selection is not really the column. What is the key board short cut for this? Thanks
Comment added at 2009-04-10 21:08:46
spaz Said:
for some reason it goes through the install process, but never appears... it also isn
Comment added at 2009-04-07 15:15:52

Post a comment