Is there a way to center the current line vertically in the Eclipse editor? - eclipse

I am looking for a functionality similar to Ctrl-l in Emacs. What it does is, for example, if you are editing the second-last line in the visible editor window and you hit Ctrl-L, the current line will move to the center of the editor screen.
This works regardless of the file end.
Most of the time, if one is creating a new file, they would be at the last line, adding more content to the file. Continually staring at the bottom of the screen is hurting my neck.

Go to Window > Preferences > General > Keys
Filter the commands to find 'Recenter'
Add preferred binding (I have Ctrl+Shift+B)
Select 'Editing Text' in the When dropdown.
Edit: unfortunately, if the cursor is at the end of the file, and you try to "recenter", it won't work because there is nothing left to show below the cursor.

Related

VS Code search inside the editor without rollover

If I search inside the actual editor of VS Code without an match below the current line, VS Code rollover the search from the top of the page.
How can I disable this?
One thing you can do instead of disabling this (which I don't thing this is configurable) is to use ctrl+U. It's soft undo, moves the cursor back to it's previous location. This is particularly useful when you need to move down in a long file to copy a variable or function name and then go back to your original position. So when vscode goes to the top of the page, put the cursor there, and then press ctrl+U to go back to the previous line you where editing.

How to navigate to the last cursor position in Eclipse if it is in the same file and was not edited?

I had used Eclipse earlier, afterwards I switched to IntelliJ for a while and now back to Eclipse. There is one thing from IntelliJ which I can't find in Eclipse: Navigating to the real last cursor position - even in the same file and even if the cursor was moved between the lines using the arrow keys on the keyboard or the mouse. IntelliJ is able to do it and I found it really useful.
For example:
I move the cursor using the keyboard's down arrow key successively on lines 10, 20, 30.
Now I am on line 30 and when I press Alt+left I would like the cursor to go to the line 20.
After pressing Alt+left again I would like the cursor to go to line 10.
After pressing Alt+right afterwards I would like the cursor to go to the line 20 again.
The following shortcuts are available in Eclipse:
Alt+left - it navigates back to the last cursor position in a different file, not to the last cursor position in the current file even if I already moved my cursor in the same file
Alt+right - it navigates forward to the next cursor position in a different file, not to the next cursor position in the current file even if I already moved my cursor in the same file
Ctrl+Q - moves the cursor to the last edit location
The latest version of Eclipse in which I tested the above-mentioned shortcuts: Eclipse Luna 4.4.0.
I found the following discussion about the same problem (lacking such functionality in Eclipse) which is quite old, but it seems that this functionality has not been implemented in Eclipse since that discussion in eclipse forum.
Does anyone of you know if this functionality will be implemented in Eclipse? Is there a plugin for Eclipse which provides such functionality of navigating back to the last cursor position?
Please note, that due to the reasons described above, I'm not satisfied with the solutions provided as an answer to this SO question 'How to navigate to the last cursor position in Eclipse?' or to the other SO question 'How to go back in Eclipse?'.
Go to Preferences / General / Keys. You'll be able to see or edit the bindings for:
Backward History: default is Alt←
Forward History: default is Alt→
You may also use those shortcuts (and see the key bindings) in the toolbar:
answered Sep 7 '12 at 8:27
Denys Séguret
There is Alt+left arrow and Alt+right arrow to navigate to previous/next cursor positions, and CtrlQ to go to the last edited position
Use bookmarks for that because there is no another way of tracking the necessary code lines. Here is the link about how to use bookmarks http://www.luisdelarosa.com/2005/02/16/eclipse-tip-use-bookmarks-to-track-important-places-in-your-code/
Screenshot of the aforementioned article's content in the link:
I use the side buttons of my mouse and it works for me
The key combination Ctrl + Q brings you back to the last locations, where editing was done.
Use Ctrl + L for an overview of shortcuts. See also Eclipse shortcuts or this Eclipse cheat sheet.
Navigate > Back (Alt+Left_Arrow) already allows to navigate back to previous cursor positions even in the same file. E.g. after you Ctrl+Click on a reference to a local variable (to go to the declaration), then Alt+Left puts the caret back to the reference.
Exlpanation source

how to change the view of open files list in netbeans 7.3.1

When I open, say a 10 or more file in Netbans 7.3.1 (windows 7), Netbeans puts each opened file's name in a a tab and all tabs are listed horizontally above the code eduitor. And at the end of that horizontal list, Netbeans provides clickable arrows (>,<,V ) to kind of navigate that list.
Since many times, the file that I want to get into is not visible in that horizontal tab list, and I need to navigate to the left or right, I usually end up clicking on the down arrow (v) and that gives me the full list of all the open files. At that time, it's a simple click to go to that file. I wish that list was available to me in a vertical fashion without an extra step.
Is there a way to see that vertical list at all times? For example, where the HTML navigator is...
I don't believe NetBeans can do this as you describe.
However, what you may find useful is Ctrl-Tab - pressing this once brings up the open file list and pressing Tab repeatedly iterates through these files. Ctrl-Shift-Tab iterates in the other direction. Letting go of Ctrl selects the currently selected file. This is similar to the Alt-Tab feature in Windows.
Hope this is useful.

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.

Ctrl-S moves the cursor near the top of the document in Eclipse

Why is it that every time I save my file in Eclipse with Ctrl-S it moves the cursor to the top of the page I'm working on? Coincidentally, it moves the cursor to the top of the JavaScript section of an HTML page I am editing. It's really annoying. How do I stop it?
Yep, was plagued by the same annoyance. In the eclipse preferences, select javascript then editor. On the editor preferences page there is a box, checked by default, called "Smart caret positioning in JavaScript names (overrides platform behavior)". Uncheck it.
I've got into the habit of hitting ctrl+Q immediately after ctrl+S
This brings you back to the last edited location.
Not so much a solution as a workaround, but it has stopped me pulling my hair out nonetheless.
S.