Select lines in Eclipse by clicking in the margin - eclipse

I'm using Eclipse CDT (Kepler) on Windows.
I'd like to select lines by clicking the mouse in the margins of the editor.
In many Windows editors (Visual Studio, Source Insight, Notepad++, Microsoft Word) if you move the mouse to the left margin of the editor, the mouse pointer (which usually points leftward) points rightward. If you click once, that selects the line; if you click and drag, it selects multiple lines.
Is there a way to configure Eclipse to behave the same way?
I find that in my left margin, the mouse pointer always points to the left. Clicking once has no effect. Click-dragging works only sometimes, which is infuriating.

There are 2 distinct left-margin areas in the Eclipse editors (at least some of the editors, including the Java editor), the overview ruler and the vertical ruler.
Click+drag line selecting has to be done in the vertical ruler area, not the overview ruler.
To select just one line, you can also triple-click anywhere on that line.
Update:
If you have Code Folding enabled, those indicators are shown in the vertical ruler when you hover the pointer over an area that can be folded. Looks like this:

Related

How do you hide the sidebars in Eclipse so you can just see the code?

I'm new to Eclipse. One of the things I like most about it is the fantastic indexing, and the symbols/function outline at the right. One of the things I like least about it is how small the code area is due to all of the side-bars (one each in Eclipse CDT at the left, right, and bottom makes the code area quite small).
Is there a quick way to toggle between hiding and showing the sidebars?
After some tinkering around I accidentally discovered it! Just double-click on your open file-name tab and it will maximize to full-screen. Double-click again to toggle it back to your normal "perspective". This applies to the left, right, and bottom sidebars too: just double-click on any of their tabs and they will maximize. Do it again to toggle back to normal size.

How to left-justify lines of code to the left edge of the window in eclipse

I have alot of code that has white space to the left of the lines of code in my eclipse project.
I would like to select pieces of this code and remove the extra white spacing so each line lines up with the left edge of the window.
You can select the code you wish, and press SHIFT+TAB until the code lines up to the edge of the screen.
You could also go to:
Window->Preferences->general->Editors->Text Editors
and when you're there, specify the tab width under:
Displayed Tab Width.
You can also customize Eclipses' formatter:
Go to:
Window->Preferences->Java->Code Style->Formatter
Select the formatter and press Edit. Edit it to your desire.
Then select the text you wish to format and press Ctrl+Shift+F

How can I scroll left and right in Eclipse editor with the keyboard without moving the cursor?

To scroll within the Eclipse editor without moving the cursor up and down one can use CTRL+Down or CTRL+Up. But what about left and right?
It is not possible. If you search keys in Eclipse's Preferences, you will find out that you only have Scroll up and Scroll down that you can set hotkeys on.
My recommendation would be changing the maximum line length in the editor.
Make your code shorter. After all, looooong lines of code are not so readable.
Also, resize your editor area. If you feel strangled, remove the Outline, TaskList, and Build view from your right side of Eclipse, and enlarge the editor.

How to show margin of block in Eclipse?

I use notepad++ or extension for Visual Studio and I have seen the line (margin) of the block like the below image.
Can Eclipse do this? Thanks!
You can turn on the "Show whitespace characters" option under General -> Editors -> Text Editors. I find that too distracting.
Eclipse has a different way to control the display of blocks of code.
See the circle with a dash right after the line number 65. You can left click on that circle to close the block.
You can hover your cursor over the circle with the plus sign to see the "hidden" code.
Left clicking on the circle will open the control block again.

How to customize icons near the scrollbar in the Eclipse Java editor?

The Eclipse java editor displays small colored rectangle icons just to the right of the scrollbar to indicate lines with //TODOs, deprecated statements, etc. One of the most useful shows the other occurrences of a currently selected variable, but the color of this one is practically the same as the background.
What are these icons called and how can I customize the colors?
Like a lot of things in Eclipse, it's easy, once you know what something is called ;-)
In the Preferences tree, that right strip is the "Overview Ruler". Here's some of my notes:
Display of Task and Bookmarks
Preferences / General / Editors / Text Editors / Annotations
Show in:
Vertical Ruler = left edge icons, in sight of current scroll position
Overview Ruler = right edge colored blocks, relative to overall file
Text as = markup the actual text