Shortcut to switch between editor and terminal?

I like to leave my terminal on while coding, and find myself clicking between editor and terminal window a lot.

Is there a shortcut to switch focus between the 2 (editor and a tool window)?

12 comments

Hi there,

Well ... Alt+F12 is a shortcut to open/hide Terminal panel (check "View | Tool Widows | Terminal" to see actual shortcut that you may have on your computer; it can be changed in "Settings/Preferences | Keymap")

Unfortunately that shortcut will hide Terminal when invoked fro the second time (inside the Terminal, e.g. to move from Terminal to the Editor -- standard behaviour for other tool windows as well).

Possible solution: disable "Override IDE Shortcuts" option in "Settings/Preferences | Tools | Terminal" (https://youtrack.jetbrains.com/issue/IDEA-116221) -- this will allow to use standard Esc to move focus back to the Editor (works from any tool window).

Other than that: https://youtrack.jetbrains.com/issue/IDEA-116865 (to be able to assign another shortcut to focus the Editor instead of rather hardcoded Esc)

10

Cool. I think that would work for me.
So I guess I should make a feature request if I want a shortcut that toggles between editor and terminal?

I think it's a frequently used feature. 

Just that I'd been relying on an external terminal before, but only recently decided to reduce dependency on other apps.

3

>So I guess I should make a feature request if I want a shortcut that toggles between editor and terminal?

It's up to you.

But most likely you will get similar answer to what I have suggested. I have big doubts that devs will introduce special shortcut just for navigating to and from specific window.

1

It is not really from and to a specific window. Is to the editor (like the most important window!). You can't consider ESC as a keybind as it is broken for the terminal.

6

@Andybergon

>it is broken for the terminal

It's not "broken" -- it's more of a "conflict of the interests" -- some people (possibly majority) want Esc to always switch to the Editor .. but some want to still be able to actually press it in the Terminal (as some programs do have a use for it).

As mentioned in the first comment -- you can tell IDE to pass all keys to IDE first ("Override IDE Shortcuts" option) so Esc will work as desired (will take focus there) but then it will stop working in actual Terminal...

Let's hope that devs will implement more dedicated action that would allow to bind other shortcut than Esc for those who want to have Esc to keep working in Terminal and have some another shortcut for switching into the Editor (tickets to watch after/vote/comment are in my first comment).

6

Wish they would address this in https://intellij-support.jetbrains.com/hc/en-us/community/posts/206375799-Keyboard-Shortcut-Focus-on-Editor?page=1#community_comment_115000519244.

For now I have to change my focus to one of the sidebars and then hit escape. Not the most ideal flow. I was considering switching to vsCode the other day partially related to this. 

2

I use Ctrl + Tab (this is on Linux)


From editor:

Ctrl + Tab, (still holiding Ctrl) T

From terminal:

Ctrl + Tab, (optional: keep holding Ctrl and navigate between editor panes with arrow keys)

7

@Benjamin Aaron March

This works great to focus the terminal, thanks for the tip!

Here's a somewhat convoluted improvement to switch back to the same editor tab (also tested on Linux):

From editor: Ctrl + Tab, then: hold Ctrl, add Shift, and press Tab

1

@Mikael Francoeur

You can go back to the editor tab with "Esc" key :)

0

It's silly to me that the one window that does not have a 'focus' action that is configurable is the Editor. E.g...

- Editing a file, navigate to the file drawer to [open a file, create directory, create file etc...] then back to the editor.
- Editing a file, navigate to the terminal to start a serve or debug process, and focus back to the editor to edit the file

Just a couple daily examples of using the Editor after doing something else in the IDE. The ESC key thing is nice, but not ideal because it's not configurable.

Suggestion: I'd like to set it to Command or Ctrl + 2 so I can access the editor like the other windows, so just needs to be configurable really.

1

I've got to add one more trick which I've recently discovered: you can create a new Terminal Tab (Ctrl-Shift-T while in terminal) and drag the tab header to the editor area, just making it a "normal" tab (you can also rename the tab header, which is handy for multiple terminal tabs). 

Thus you can use alt-left alt-right for switching between editor (when in override IDE hotkeys mode), i usually assign "go to next splitter" shortcut and split working area vertically or horizontally in as many terminal windows as I need.  

 

 

0

Jumpt to terminal: Alt + F12

Jump back to editor: ESC*

*You'll need to disable the: "Preferences > Tools > Terminal > Override IDE shortcuts" option first 

 

Alternative to go back to the editor: Ctrl + Tab and then select the editor you want. 

0

Please sign in to leave a comment.