Eclipse jump to Editor tab shortcut - eclipse

I am wondering if there is any way to have a keyboard shortcut to a tab. Like for example Firefox having Alt+1 / Alt+2 / Alt+3 to go to tab 1 / 2/ 3 etc...
Cheers,

You can use F12 to go to the current editor and Ctrl + E to get a list of open editors. Then you can type a couple of characters to narrow down the list. The currently visible tabs are at the end of the list (use End or Up to jump there)
Ctrl + PageUp and Ctrl + PageDown select the previous and the next tab.
Ctrl + Q goes to the last edit position.
Alt + Left and Alt + Right go back- and forward through your editing history (like the back button in your browser).

Also, use Alt+PgUp and Alt+PgDown to shift between graphical layout and xml code inside android graphical layout editor for xml files.

for right side move CTRL+ page Down
for left side move CTRL+page Up

Using CTRL+F7 to navigate between two currently used views back and forth (kinda ALT+TAB in Windows).

Related

Go to definition and back to reference in Visual Studio Code

I'm currently using VSCode and am trying to use the F12 shortcut which takes me to a definition of an object/function. When I want to go back to the reference, I can't seem to find the right way to do it. With VS community I used Shift + F12.
I've try different combinations, such as Alt + F12 or Shift + F12 but all I get is a peek definition of the element which is not useful at all; it's just a popup showing the same element in the same file I'm at. I've seen answers to this question but pertaining to VS 2010 which are no longer applicable or doesn't work with VSCode.
Question: What is the shortcut to Go Back once you've used F12 to Go to the definition?
For macOS it is ⌃- (Ctrl + -) by default. And for Windows: (Alt + LeftArrow)
According to the vscode keyboard shortcuts documentation page, the navigateBack action defaults to Ctrl+Alt+-.
In my keybindings.json file, I've rebound it to ctrl+- using:
{ "key": "ctrl+-", "command": "workbench.action.navigateBack" }
You can open the Keyboard Shortcuts to find the shortcuts.
Preferences > Keyboard Shortcuts
Search for Go, and it’ll show the Go Back and Go Forward shortcuts.
In macOS:
Go Back: ⌃- (Ctrl+-)
Go Forward: ⌃⇧- (Ctrl+shift+-)
[
{
"command": "workbench.action.navigateBack",
"key": "ctrl+-"
},
{
"command": "workbench.action.navigateForward",
"key": "ctrl+shift+-"
}
]
Shift + F12 should be working for you. There is a box on the right of the peek view which lists all the references. You are seeing the peek view to the reference you went to (the definition) but on the right are more. That boundary between the two can be dragged left and right so perhaps yours is not visible - trying dragging the peek view box right boundary to the left after you hit Shift+F12. Do you see a list of references there? Double-clicking the one you started from originally will take you back to it.
Edit:
v1.29 added some nice functionality for listing the references in the sidebar. See references view.
List All References in the context menu or Shift+Alt+F12
Results are stable and individual results can be cleared, which is great if you use the view as a To Do list. You can use F4 and Shift+F4 to navigate through results without taking your hands off the keyboard.
ALT + Left Arrow and ALT + Right Arrow worked for me. VS code listed all shortcuts in pdf keyboard-shortcuts-windows.pdf.
To see all keyboard shortcuts go to menu bar Help->Keyboard Shortcuts Reference. It will open pdf that contains all shortcuts.
Alt + Left arrow worked for me or Go menu and then Back.
Try goto-symbol-stack.
This extension implements a stack tracking the positions only when the goto-definition is triggered by Alt+], and allows the user go back to the reference using Alt+[. No annoying cursor movement in the stock navigation(Alt+←).
For those using the VSCodeVim extension, it would be Ctrl + o and Ctrl + i
An alternative approach is to use the Ctrl+Alt+Click shortcut, which will open the definition in a new pane to the right. This can then be closed with the usual Ctrl+F4 key combination.
The keyboard shortcut commands are Go Forward and Go Back.
On Windows:
Alt + ← ... navigate back
Alt + → ... navigate forward
On Mac:
Ctrl + - ... navigate back
Ctrl + Shift + - ... navigate forward
On Ubuntu Linux:
Ctrl + Alt + - .., navigate back
Ctrl + Shift + - ... navigate forward
ref
1.Go Definition - F12 or Right click and Click Go to Definition Option
2.Back to Reference - Alt + Left Arrow
Go to definition F12
Back to declaration Ctrl + F12
Next : Ctrl + F12
Back : Alt + LeftRow (<--)
For Windows is working.
I have a similar problem. Fix it by installing this JDK 8 to VSCode
In Version: 1.62.3 under Ubuntu:
it's just F12 again
it's bound to both:
Go to Definition
and
goToNextReference

How can I navigate back to the last cursor position in Visual Studio Code?

What is the keyboard shortcut to navigate back to the last cursor position in Visual Studio Code?
The keyboard shortcut commands are Go Forward and Go Back.
On Windows:
Alt + ← ... navigate back
Alt + → ... navigate forward
On Mac:
Ctrl + - ... navigate back
Ctrl + Shift + - ... navigate forward
On Ubuntu Linux:
Ctrl + Alt + - ... navigate back
Ctrl + Shift + - ... navigate forward
I am on Mac OS X, so I can't answer for Windows users:
I added a custom keymap entry and set it to Ctrl + ← + Ctrl + →, while the original default is Ctrl + - and Ctrl + Shift + - (which translates to Ctrl + ß and Ctrl + Shift+ß on my German keyboard).
One can simply modify it in the user keymap settings:
{ "key": "ctrl+left", "command": "workbench.action.navigateBack" },
{ "key": "ctrl+right", "command": "workbench.action.navigateForward" }
For the accepted answer I actually wonder :) Alt + ← / Alt + → jumps wordwise for me (which is kind of standard in all editors). Did they really do this mapping for the Windows version?
This will be different for each OS, based on the information in Key Bindings for Visual Studio Code.
Workbench configuration:
Go Back: workbench.action.navigateBack
Go Forward: workbench.action.navigateForward
Linux:
Go Back: Ctrl+Alt+-
Go Forward: Ctrl+Shift+-
Mac OS X:
Go Back: Ctrl + -
Go Forward: Ctrl + Shift (⇧) + -
Windows:
Go Back: Alt + ⬅️
Go Forward: Alt + ➡️
To answer for your question, for:
Windows use Alt+← for backward, and Alt+→ for forward navigation.
macOS use Ctrl+- for backward, and Ctrl+Shift+- for forward navigation.
Linux use Ctrl+Alt+- for backward, and Ctrl+Shift+- for forward navigation.
You can find the current key-bindings in "Keyboard Shortcuts editor."
You can even edit the key-binding as per your preference.
There is an extension available named Code-Navigation for all the platforms. As an alternative to the keyboard shortcuts it adds buttons to the left side of the status bar.
To set your own keyboard shortcuts (even if that particular keyboard-combo is already taken) you can go to Code > Preferences > Keyboard Shortcuts and set them up there.
Open Settings: Code > Preferences > Keyboard Shortcuts
Find Go Forward and Go Back and set them to whatever you like.
If a key shortcut is double-assigned VSCode will tell you, and you can click-in and change/remove the other ones. eg. by shortcuts were already assigned to indent-in and indent-out.
eg. our main tool is Android Studio on a mac which uses cmd+[ and cmd+] for forward and backward). This is especially powerful with a cmd+click for drilling into functions. (so you can follow your code as if it was an Ariadne's thread in a Minotaur labyrinth. Does help! ( so you jump around the code, diving in and out of functions, and back between files.
For macOS:
⌘ + U: Undo the last cursor operation
You can also try Ctrl + -.
BTW, all the shortcuts are in Keyboard shortcuts for macOS. This is really useful!
Use Alt + ← / →
You can find all shortcuts in Key Bindings for Visual Studio Code.
Mac OS (MacBook Pro):
Back: Ctrl(control) + - (hyphen)
Back forward: Ctrl + Shift + - (hyphen)
As an alternative to the keyboard shortcuts, there is an extension named "Back and Forward buttons" that adds the forward and back buttons to the status bar.
vscode v1.65 is adding a number of new commands for navigating to the last/next edit location or the last/next cursor location.
An edit location means there was an actual edit, whereas a cursor location means that you visited that location but may not necessarily have made an edit there.
By default, editor navigation locations are added whenever you
navigate across editors but also when navigating within editors (for
example, when switching notebook cells or changing selection in text
editors). If you feel that too many locations are being recorded, new
commands have been added that reduce locations to either:
Navigation locations (for example when using Go to Definition)
Edit locations (whenever an editor is changed, for example when typing in a text editor)
from https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_65.md
Cursor locations:
Go Forward in Navigation Locations
"workbench.action.navigateForwardInNavigationLocations"
Go Back in Navigation Locations
"workbench.action.navigateBackInNavigationLocations"
Go to Last Navigation Location
// acts like a toggle between current and last cursor location
"workbench.action.navigateToLastNavigationLocation"
Go Previous in Navigation Locations
"workbench.action.navigatePreviousInNavigationLocations"
Edit locations:
Go Forward in Edit Locations
"workbench.action.navigateForwardInEditLocations"
Go Back in Edit Locations
"workbench.action.navigateBackInEditLocations"
Go Previous in Edit Locations
"workbench.action.navigatePreviousInEditLocations"
Go to Last Edit Location
// acts like a toggle between current and last edit location
"workbench.action.navigateToLastEditLocation"
Associated context keys have been added to make assigning keybindings
more powerful:
canNavigateBackInNavigationLocations: Whether it is possible to go back in navigation locations
canNavigateForwardInNavigationLocations: Whether it is possible to go forward in navigation locations
canNavigateToLastNavigationLocation: Whether it is possible to go to the last navigation location
canNavigateBackInEditLocations: Whether it is possible to go back in edit locations
canNavigateForwardInEditLocations: Whether it is possible to go forward in edit locations
canNavigateToLastEditLocation: Whether it is possible to go to the last edit location
You can go to menu File → Preferences → Keyboard Shortcuts. Once you are there, you can search for navigate. Then, you will see all shortcuts set for your Visual Studio Code environment related to navigation. In my case, it was only Alt + - to get my cursor back.
While the accepted answer is correct, anyone using the Vim extension for VS Code may be frustrated by the fact that navigating backwards takes you through every single cursor movement you've made. This prevents "Go back" from working well for use cases like:
Go to Definition
Poke around at the definition for a while (i.e., move the cursor around)
Go Back to where you were in step 1.
With the Vim extension installed, you'll be stuck doing "Go Back" for every cursor movement you've made (and for me, that's enough to make it almost useless!).
Fortunately, the Vim extension implements jumplists well, so after using VS Code to jump to a new position (i.e., "Go to definition"), you can simply do CTRL+O to go back to the previous jump location.
Last Edit Position v. Last Navigation Position
Go To Last Edit Position:
Ctrl+k Ctrl+q
This was mentioned in sudormfbin's comment but not listed as an answer. This is what I want to do 99% of the time when I think "where was I now?". It is the easiest quickest way to get back to your last position without taking your fingers off keyboard to use the arrow keys and without installing extensions, etc.
Navigate Recent Cursor Positions:
ALT+ ← Back
ALT+→ Forward
Most of the other posted solutions refer to this - moving between "Navigation Locations", i.e., navigating between editor tabs OR within an editor (e.g., you move the cursor on one line, then click on a line 20 spaces above).
For navigating between editor tabs, instead of the above you can do Ctrl+Tab as it will sort all of the tabs in most recent order so you have option to go to others or just release and go back to the last used one. Also without taking fingers off keyboard.
With Visual Studio Code 1.43 (Q1 2020), those Alt+← / Alt+→, or Ctrl+- / Ctrl+Shift+- will also... preserve selection.
See issue 89699:
Benjamin Pasero (bpasero) adds:
going back/forward restores selections as they were.
Note that in order to get a history entry there needs to be at least 10 lines between the positions to consider the entry as new entry.
There are several ways to go back and options to go back in vs code.
To change any of the following things, go to command pannel by pressing ctrl + p and then after typing a >, type what config you need to change:
Then all you need to do is click on the Settings icon (as pointed by 2 in the image) and change the key binding to whatever you want.
Different options you have for going back:
Go to the Last Edit Location
Cursor Undo (meaning: go to last cursor location)
Cursor Redo (Opposite of above)

Switching between side by side text windows in Eclipse

I have an eclipse window with two tabs open side by side so that I can see the text of both files simultaneously. Is there a keyboard shortcut that allows me to switch which window I am editing?
I usually use Ctrl + F6, it will pop-up a small context menu were with all editors and windows, by default it switch you to the next editor in the list. And
Ctrl + Shift +F6 goes to the previous editor in the list.
It's not exactly what you asked for, but i cannot found simple shortcut for switching windows. You can read this article for more info
You can also create your own perspectives (Window --> Save Perspective As...) and easily switch between them:
Ctrl + F8 Next perspective
Ctrl + Shift + F8 Previous perspective

Is there a shortcut for switching between panels in eclipse?

Eclipse has an MDI structure (Multi Document Interface), so the search panel, the package explorer and the code editor can all be open in one window, but I haven't found a keyboard shortcut for switching between these panels. For example, after I search the code-base, I would love to have a quick shortcut for going back to the code editor.
If I understand your question correct, you are probably looking for Ctrl + F7 and Ctrl + Shift + F7. Other navigational shortcuts can be found in the menu: Window > Navigation.
Not an universal shortcut for going to any panel, but:
Ctrl+Shift+E
allows you to go back to any Editor (although it's still a little heavyweight for quick editor navigation).
And if you want to switch between perspectives its: Crtl + F8 and Ctrl + Shift + F8. You can go to Help > Key Assist... for a full list of shortcuts (this list will change depending on the active editor etc.).
There are two ways to do it.
One is how #VonC did it, in an earlier reply; using CTRL+SHIFT+E which opens a box containing all the panes with their paths.
The other one is to simply use CTRL+E, which will open a pop-up just over your cursor containing the list of panes open. Parse using arrows and ENTER

Shortcut for "move to left editor" and "move to right editor" in Eclipse?

If I've got my Eclipse windows split vertically, is there any keyboard shortcut to move to the logical left/right editor?
For example, in the image blow, the right editor is selected, and I want to move to the left window:
For those of you who know Vim, I am trying to recreate c-w h and c-w l.
The answer from Csaba_H is right : there is no keyboard shortcut to switch from one editor area to the next. The most you can do through keyboard shortcuts is to switch to "another editor", whatever its area is (left, right, top, bottom... whatever you tiled the area into :p) through the usual shortcuts :
next editor : ctrl + F6
previous editor : ctrl + shift + F6
quick switch editor : ctrl + E
I'll only mention that you can also take a look yourself to all available shortcuts in your Eclipse if you go to Window > preferences and go into the section General > Keys (a shortcut to get there is to use ctrl + shift + L twice).
Personally I did not find such shortcut or option. However, there are some possibilities for switching editors from the keyboard (Ctrl + F6 and Ctrl + Shift + E as general ones, or my favourite "all-in-one" Ctrl + 3 :) ).
Also, if you work mostly two files 'for a long time' (one in left side and one on right side), you can also use the History operations (Alt + ←, Alt + →) for switching editors.
Eclipse allows for multiple editors to be open at any time, and those editors may be arranged as tabs (default behaviour) or split vertically or horizontally. The information above about available shortcut options is correct and provides the correct functionality in the case of two (only) open editors. Where there are greater than two open editors the shortcuts allow navigation to the 'next' or 'previous' editor. There is no concept of the logical left/right or top/bottom editor.
Just found it!
Ctrl + Page Up and Ctrl + Page Down.
It's just Ctrl + Tab and Ctrl + Shift + Tab on my windows! try it.
In all my eclipse usage I've never noticed such a shortcut and I would not expect one to exist. I skimmed though the link provided by Anthony and checked my own copy of eclipse, but none of it looked like what you're looking for.
You can also look through them yourself by going to: Window > Preferences > General > Keys
I'm not sure if there is something in vanilla Eclipse, but you might want to check out "Emacs+" in the Eclipse Marketplace.
From http://www.mulgasoft.com/ :
"Other Window (Ctrl-X O): Navigate to the previous editor window"
It's not perfect, but it will achieve something close to what you want.
You can also split the window with shortcuts as well.
Quick Access Ctrl+3 has been very useful in Eclipse.
Otherwise, I know of two external programs that navigate by dividing the screen into smaller chunks, using only your keyboard.
If you're on Windows, you can use Mouser, which is coded in Autohotkey and based on keynav. If you find the source, remapping the keys is fairly straightforward.
If you're on Linux, keynav is your friend.
sudo apt-get install keynav
You'll have to change the configuration file to use arrow keys. (The default uses vim-like navigation.)
For focusing panels in Eclipse, I average between two-to-three keystrokes.