How do I enable the column selection mode in Eclipse?
Asked Answered
V

8

380

News wrote that Eclipse 3.5 finally supports column selection. Unfortunately I don't know HOW to enable it. I tried pressing the ALT-key like I am used to in Visual Studio and all other Microsoft products but that had no effect.

How can I mark a vertical block in Eclipse?

Vallery answered 27/6, 2009 at 21:59 Comment(0)
T
511

To activate the cursor and select the columns you want to select use:

Windows: Alt+Shift+A

Mac: command + option + A

Linux-based OS: Alt+Shift+A

To deactivate, press the keys again.

This information was taken from DJ's Java Blog.

Taut answered 27/6, 2009 at 22:8 Comment(10)
I see, it is a whole "mode" that needs to be enabled.Vallery
alt+shift+a dnw for me on osxWhelk
alt+shift+a is not working in my eclipse. how to enable it from the eclipse?Toole
I think it's an Eclipse 3 or 3.5 feature?Doctrine
This is not working for me in Android Developer Tools Build: v22.0.5-757759 edit: Look down Android devs!Spragens
For Eclipse Kepler on Mavericks its command + option + AClastic
Ohh.. it works.. but it feels so primitive compared to Textmate, Sublime, Atom....Photometry
If it doesn't work for you, try to start marking text normally and while the selection is there, click the alt-shift-aFabulist
In my Eclipse it works for .java files but not for .md files... I guess it's not in the generoc Structured Text Editor but only in some of the more specific editors... Beats me why, seems to me column editing is a generic option.Condottiere
A little off topic but if you were an eclipse editor developer, what library or functions would you use to implement this feature (i.e., pressing Alt + Shift + A simultaneously switches the mouse cursor to "block select")?Towner
D
123

On Windows and Linux, it's AltShiftA, as RichieHindle pointed out. On OSX it's OptionCommandA (A). It's also worth noting that the two modes can have different font preferences, so if you've changed the default text font, it can be jarring to toggle block selection modes and see the font change.

Finally, the "search commands" (Ctrl3 or Command3) pop-up will find it for you if you type block. This is useful if you use the feature just frequently enough to forget the hotkey.

Dr answered 6/8, 2010 at 18:15 Comment(3)
To modify the font in this selection mode: Eclipse -> Preferences -> General -> Appearance -> Colors and Fonts -> Basic -> Text Editor Block Selection Font.Hannon
Is there a way to enable column mode select when looking in the console or JUnit console view? Alt-Shift-A only works in the source code editing window / view.Saddlebow
I don't see any way to enable block selection in the console -- you could copy the content out to an Eclipse buffer and then select there.Dr
H
66

As RichieHindle pointed out the shortcut for column (block) selection is Alt+Shift+A. The problem I ran into is that the Android SDK on Eclipse uses 3 shortcuts that all start with Alt+Shift+A, so if you type that, you'll be given a choice of continuing with D, S, or R.

To solve this I redefined the column selection as Alt+Shift+A,A (Alt, Shift, A pressed together and then followed by a subsequent A). To do this go to Windows > Preferences then type keys or navigate to General > Keys. Under the Keys enter the filter text of block selection to quickly find the shortcut listing for toggle block selection. Here you can adjust the shortcut for column selection as you wish.

Hofmannsthal answered 22/10, 2011 at 20:29 Comment(6)
it's a very useful information for Android developers. thank you.Mccoy
That was easy. Great utility for all Android devs. Thank you!Peterman
Especially nice to put the instructions here... I was searching for toggle block selection in the Keys entry already, but I had no idea what the name was...Limb
I wish there was a way to get rid of the anoying android als+shift+a choices :( and no I don't have the android plugin installed as far as I can tell)Sparker
I unbound all the other ALT+Shift+A commands and toggle block selection isn't working as a hotkey currently. EDIT: Restarting ADT fixed the hotkey issue. Alt+Shift+A is working fine now.Spragens
@Sparker You can easily unbind the Android plugin's shortcuts from the above-mentioned Keys dialog. However, if you don't have the Android plugin installed, then you don't have its shortcuts either.Innermost
C
28

First of all your mouse key must be focus in editor to enable Toggle Block Selection Mode

enter image description here

Click on toggleButton as shown in figure and it will enable Vertical selection. After selection toggle it again.

Capelin answered 2/2, 2015 at 8:42 Comment(3)
This works on ADT, also it shows that the shortcut is Alt+Shift+A but that doesn't work.Lederer
Thanks for the screenshot. The keyboard shortcuts listed here assume the shortcut actually works. Since that is non-visual, pointing to the button is a great reference. Plus, the button indicates its shortcut key with a tool-tip. In this case, the ALT+SHIFT+A solution, which does not work in the Android Developer Tools v22.0.1-685705.Ectopia
This option is also available under Edit >> Toggle Block Selection.Inexpensive
S
16

Additionally, you can change the keys view window -> preferences then type: 'keys' and when the key preference page opens you can type 'toggle block selection' and voila!

Spank answered 27/6, 2009 at 22:15 Comment(1)
Thanks for the info. I am new to the Eclipse IDE and only knew the "Key-Assist" window.Vallery
B
10

You can enable and disable column editing mode via the keyboard shortcut ALT-SHIFT-A.

Once enabled you can then use either the mouse to select a block of text, or the keyboard using SHIFT (like a normal keyboard select, except the selection will now be in a block).

If you've changed your default font for text editing, entering column editing mode will probably change your screen font to the default column editing font (which is probably different to your changed font. To change the font when in column editing mode, go to the menu and select Window -> Preferences, then in the tree on the left hand side, pick General -> Appearance -> Colors and Fonts, and then pick Basic -> Text Editor Block Selection Font on the right hand side tree. You can then select the font to be consistent with your "not in column editing mode" font.

Bibbye answered 16/8, 2011 at 5:30 Comment(0)
A
8

A different approach:

The vrapper plugin emulates vim inside the Eclipse editor. One of its features is visual block mode which works fine inside Eclipse.

It is by default mapped to Ctrl-V which interferes with the paste command in Eclipse. You can either remap the visual block mode to a different shortcut, or remap the paste command to a different key. I chose the latter: remapped the paste command to Ctrl-Shift-V to match my terminal's behavior.

Anson answered 8/12, 2013 at 5:44 Comment(0)
I
1
  • Press Alt + Shift + A
  • Observe that the screen zooms out
  • Make selection using the mouse
  • Press Alt + Shift + A to go back to the old mode. enter image description here
Improbity answered 3/1, 2020 at 8:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.