In PyCharm how to go back to last location?

63,103

Solution 1

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 2

Under ArchLinux with PyCharm CE 3.1 works the combination Ctrl + Alt + Left.

This is the way I find out the combination:

  1. (Right click) Go To -> Implementation(s)

  2. Double Shift -> Back

    enter image description here

  3. There is an option Back in the section Actions

  4. Ctrl + Shift + A

    enter image description here

  5. And then the cursor comes back

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!

Solution 5

Alt + Shift + left

The above works with PyCharm 2016.3.2 if you select the keymap "default for GNOME".

Share:
63,103
Berry Tsakala
Author by

Berry Tsakala

Updated on February 22, 2022

Comments

  • Berry Tsakala
    Berry Tsakala over 2 years

    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:

    1. I'm navigating to a function body,
    2. put the cursor on a function call,
    3. click F12 ("go to definition")
    4. 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?

    • Robino
      Robino almost 3 years
      Ubuntu 18.04 bionic / PyCharm 2021.2>>>>>>Alt+Shift+Left
  • Berry Tsakala
    Berry Tsakala almost 10 years
    thank you for the useful "actions" tip (upvoted, fwiw), but as i mention - ctrl-alt-left didn't work for me, hence, irrelevant. see my answer
  • Melanie
    Melanie over 9 years
    just a warning - on windows 7, ctrl-alt-left arrow rotates the screen!
  • awesoon
    awesoon over 9 years
    @Melanie, It is, probably, because of your graphics settings. As far as I remember, there is some shortcuts for rotating / mirroring / duplicating / etc. shortcuts in Intel Graphics module.
  • Romain Jouin
    Romain Jouin almost 7 years
    how do you that on a small keyboard with direct [ stroke ? I am on a mac book air 11 inch
  • Dunes
    Dunes over 6 years
    In version 2017.2.3 (probably before as well) this has been changed to alt-shift-left
  • awesoon
    awesoon over 6 years
    Both ctrl+alt+left and shift+alt+left works for me (pycharm 2017 2.3)
  • Bobort
    Bobort over 6 years
    But navigating to the previous change is different than navigating to the previous location. When I'm reading my code to understand it, I don't want to make a change to it.
  • J.G.
    J.G. about 6 years
    Unsurprisingly, you can then also "go forward again" using ctrl-alt-right.
  • Benyamin Jafari - aGn
    Benyamin Jafari - aGn about 5 years
    Thanks for the guidance, it works. But alt+left was already taken for me to another action.
  • Michele Piccolini
    Michele Piccolini about 4 years
    On pycharm 2020 (linux) I have Shift-Alt-Left (not Ctrl-Alt-Left anymore) as default for the Back action.
  • Josiah Yoder
    Josiah Yoder almost 4 years
    Still true in PyCharm 2020.1.1
  • egvo
    egvo about 3 years
    Back does switching tabs for me. Just like Ctrl+PgUp, Ctrl+PgDn do. If my files are already opened it doesn't switch just back to the previous code (like if I'm dropping into function Declaration). Sad thing, but I can't find a solution.
  • David Parks
    David Parks over 2 years
    Same on PopOS/Ubuntu based distro, PyCharm 2020.3
  • phi
    phi over 2 years
    option+cmd+left arrow worked for me, nice!