267

I can use F12 to jump to project tree (if it was the last tool that I used), but is there a shortcut for jumping back to editor?

embert
  • 7,336
  • 10
  • 49
  • 78
Flashrunner
  • 2,874
  • 2
  • 14
  • 12

8 Answers8

581

Esc usually brings the focus back to the editor.

ESV
  • 7,620
  • 4
  • 39
  • 29
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Any idea if it's possible to bind additional key combinations to this action? – Ionuț G. Stan Apr 27 '12 at 09:45
  • @IonuțG.Stan, I'm afraid, no. – CrazyCoder Apr 27 '12 at 10:00
  • 3
    This is broken in VIM-emulator mode (escape does mode switching instead), and there is no way to bind another keystroke to focusing the editor. – Excalibur Mar 28 '13 at 20:04
  • For reference I have reported this issue here: http://youtrack.jetbrains.com/issue/VIM-591 – Silas Davis Dec 11 '13 at 15:30
  • 34
    Hi! That doesn't seem to work with terminal, sadly. Know of any workaround ? – Ven Dec 26 '13 at 01:43
  • 27
    Exactly what @Ven said. Some tool windows only respond to Shift-Escape, which works but hides the tool window. – spieden Feb 06 '14 at 02:00
  • I previously requested that this be configurable: https://youtrack.jetbrains.com/issue/IDEA-116865 – pondermatic Nov 02 '14 at 23:15
  • 7
    There are a few workarounds for terminal. See this answer: http://stackoverflow.com/a/23860667/722929 – Tobber Feb 13 '15 at 08:18
  • Not always. When I select something in tool window when I press esc it deselects it. Second Esc will go to editor but that's not convenient as it requires feedback - check if I'm in editor, if not press esc again. Also I would like to keep selection in tool window, not remove it – NickSoft Jan 25 '17 at 12:06
  • Esc, F4, Alt+Home, Crlt+Shift+A "Edit" does not work if you have some toolbars in windowed mode. Is there any other option? – Pavol Liška Mar 07 '17 at 09:44
  • @PavolLiška there is no other option, [file a bug](https://youtrack.jetbrains.com/issues/IDEA). – CrazyCoder Mar 09 '17 at 20:31
  • Go to Settings | Tools | Terminal and disable "Override IDE shortcuts" option - it will help to navigate from Terminal to editor using `ESC`. – Alex Skrypnyk Aug 18 '19 at 00:37
25

With Alt + Home you can actually put focus on selecting the file and hit enter in order to go to the editor.

Esc is not always going to put the focus on editor.

For those on Mac (you don't have a Home key), use Command + E to open the recent files then hit enter.

dvorak4tzx
  • 493
  • 7
  • 8
M.Rez
  • 1,802
  • 2
  • 21
  • 30
14

Pressing F4 (Jump to Source action) in a selected resource in the Project View opens the editor with focus.

davidxxx
  • 125,838
  • 23
  • 214
  • 215
Marcos Vasconcelos
  • 18,136
  • 30
  • 106
  • 167
  • 2
    This is really annoying that I had to add Enter key as a second shortcut (alongside with F4) to open and *focus* file from Project view – avalanche1 Mar 06 '18 at 09:06
  • 1
    Best workaround for me because it doesn't hide any other window. Thanks. – davidxxx Jun 25 '19 at 08:06
8

Another easy way to get from Terminal to Editor (on Mac) with two keys that are close together: Press ⌘1 to go to the project tool window, then hit Esc.

5

You can use ctrl + tab Navigate between files opened in the editor, and tool windows.

Sample

sendon1982
  • 9,982
  • 61
  • 44
4

This is definitely a workaround, but, on mac os the following keystrokes work,

[ SHIFT + CMD + A ] > type "edit" > [ ENTER ]

So, I created a Service using Automator as follows,

  • receives no input
  • active for my IDE only ( phpstorm )
  • runs an AppleScript ( see below )

Then I mapped the Service via "System Preferences > Keyboard > Shortcuts > Services" to

[ CTRL + OPTION + CMD + i ]

The Automator Service, contains the following AppleScript,

on run {input, parameters}
    tell application "System Events"

        keystroke "A" using {shift down, command down}

        delay 0.2
        keystroke "edit"

        delay 0.2
        keystroke return

    end tell

    return input
end run
searaig
  • 61
  • 4
3

The most elegant way found in mac: ctrl + tab + p

ctrl + tab: open recent file, always last file opened
ctrl + p: last line in mac default keymap

liaoming
  • 153
  • 3
  • 10
2

There is no perfect solution, since Escape doesn't work if your other Tool Window is a Terminal, Windowed... as a result there is an open ticket on Jetbrains, bug tracking site see this link.

Also, if you have "Autoscroll to Source" disabled (default state in Intellij):

  • Escape puts cursor in file currently visible in editor (As mentioned in the other Answers)
  • F4 puts cursor in file currently selected in the Project view.
Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
pawel
  • 518
  • 7
  • 21