In PyCharm, how to go back to last location?
Edit: my system had global key map which had overridden PyCharm. Here's the original question:
I've tried these answers, but nothing happened: Keyboard shortcut for Jump to Previous View Location (Navigate back/forward) in IntelliJ IDEA
For example:
- I'm navigating to a function body,
- put the cursor on a function call,
- click F12 ("go to definition")
- from the new location (the function's body), how do I return to the function call?
I've tried these, but they didn't do anything:
- Ctrl+Shift+Left
- Ctrl+Shift+F2 <-- this is my default mapping
- Alt+Shift+Left
- Ctrl+Shift+backspace
- don't try that on linux: Ctrl+Alt+backspace
Or maybe F12 ("go to def") isn't "strong enough" to trigger a location-change event?
Solution 1:
Under ArchLinux with PyCharm CE 3.1 works the combination Ctrl + Alt + Left.
This is the way I find out the combination:
-
(Right click) Go To -> Implementation(s)
-
Double Shift -> Back
-
There is an option
Back
in the sectionActions
-
Ctrl + Shift + A
-
And then the cursor comes back
Solution 2:
All in all, it has nothing with PyCharm;
In my case, there was a global key combo of another program, that masked Ctrl-Alt-Left
I solve it by remapping "file > settings > keymap > main menu > navigate > back".
I chose Alt+Left, which intuitively feels likes web browsers "back" behavior.
Solution 3:
In mac OS X (atleast in El Capitan) it is by default cmd + [ to go back to the previous location.
update: if that doesn't work also try option+cmd+left arrow
Solution 4:
Update for year 2016 to at least 2020.1.1:
In PyCharm 2016+ on windows the correct default is Ctrl+Shift+Backspace
https://www.jetbrains.com/help/pycharm/2016.2/navigating-to-next-previous-change.html
Be warned that Ctrl+Alt+Left will rotate your entire screen on Windows 10. If you're reading this with your head cocked sideways, Ctrl+Alt+Up will get you back vertical!