Way to jump back to previous file/line after Ctrl+clicking function call?

I frequently have to jump into function call on a line, which takes me to a different line or file, and it's not easy to go back to the line I clicked from, so is there a keyboard shortcut or something that will take me back?

23 comments

Hi there,

Many options -- choose which one works best for you:

  • Navigate | Back
  • Navigate | Last Edit Location
  • View | Recent Files
  • Ctrl+Tab (switch to the last (most recent) tab -- similar how Alt+Tab works)

Just check what shortcuts those actions have on your OS / your Keymap.

16

Ctrl+alt+left arrow to go back to previous location and Ctrl+alt+right arrow to go forward.

29

Cccabdalla, are you using macOS? If so, it's a different shortcut there: Cmd+Alt+Left/Right.
You can check the shortcut in Settings/Preferences | Keymap | Search for action "Back"

5

Turns out the keyboard shortcut on Mac to "Navigate Back" is ⌘[

11

On Linux at least Navigate | Back is Alt+Shift+Left Arrow

6

On Linux, use Ctrl + Alt + Left Arrow/Right Arrow to retrace your jump history seamlessly. Note that even when you use Ctrl + Tab, you can use the above shortcuts to navigate through the jump history. If the above shortcuts don't work the shortcuts must have been allocated to some OS level function. (Using CLion v2017.3 on Ubuntu 16.04)

1

If you have a mouse that has back and fore buttons (Like a gaming mouse or so) whenever you CTRL + CLICK to go to a definition(even if it is in another file) by clicking the back button in your mouse, it will take you to the previous place where you were (And it also has a history so that you can navigate back and fore between places)

It's pretty cool, you should try it!

1

Ctrl+Alt+Left Arrow (for the default key map)

2

Cmd+Alt+Left/Right is no longer working on OS X. Is it a bug?

0

Still works for me. Please check if the shortcut set for you:

> You can check the shortcut in Settings/Preferences | Keymap | Search for action "Back"

1

@Anshumandhuliya Thanks for your comment. Using Linux Mint 18.3 Sylvia, the default OS mapping for Ctrl+Alt+Left/Right is to switch workspaces. I just changed those keybindings to Ctrl+Alt+4/6 and the Ctrl+Alt+Left/Right works in JetBrains now.

0

Can confirm that the Mac shortcut is still cmd]+[ for back and cmd+] for forward

0

The problem with the keys combination is that, if they are configured to by default to do something by the operating system, they won't do what IntelliJ wants them to.

Go to the View menu and check the 'Toolbar' option. Then you will see the back and forward navigation arrows somewhere in the left part of the upper bar. These will work on all operating systems and you won't need the keyboard combination anymore.

 

0

@Noexpresion

>The problem with the keys combination is that, if they are configured to by default to do something by the operating system, they won't do what IntelliJ wants them to.

How about assigning your own shortcuts that are suitable to you and your OS?

"Settings/Preferences | Keymap"

2

You can use Shift + Alt + Left Arrow it worked for me in IntelliJ and my os is Ubuntu

 

0

The problem is that when I jump back from some file it doesn't close the opened file it visited , which leaves many files open and requires manual cleanup , is there a way to automatically close files when jumping back ? 

0

Nikolai Orenstrakh, there is a request for ignoring closed files completely, but no request for closing files while you move between them.
https://youtrack.jetbrains.com/issue/IDEA-157301
Please submit a new one: https://youtrack.jetbrains.com/newIssue?project=WI

0

hmmm , this request https://youtrack.jetbrains.com/issue/IDEA-157301 is opened since 2016 :) what are the chances my request will get priority ?

0

We unfortunately can't provide any estimates.

0

What is the short cut in Ubuntu 18.04 ... here in ubuntu Alt + Shift + ctrl + Arrow keys will switch between workspaces

0

@Kalanka Siyambalapitiya

It depends on your Keymap used in IDE.

Please check the list of actions in my very first comment and look what shortcut it has, e.g. "Main Menu | Navigate | Back"

If you want to change that shortcut to some another, you can do it via "Settings (Preferences on Mac) | Keymap"

1

Please sign in to leave a comment.