Keyboard shortcut to switch between python console and the editor in pycharm

30,477

Solution 1

In Pycharm 4, you can specify shortcuts with

File / Settings / Appearance and Behaviour / Keymap

You can create any shortcut you like, and bind it to the command "Python Console" (search for Console), which has no default keymapping. Be aware that it is possible to have multiple consoles open at the same time (for example if you open one in the debugging window) so this may not always behave as you expect it to.

You can toggle back to the last editor window by hitting escape.

Solution 2

If you mean the "Run" window (which has a console in it) you can open it/switch to it with Alt + 4. See the screenshot for the two locations this is indicated.

As mentioned by vape, Esc should return you to your most recently used editor. Alternatively, pressing Alt + 4 again seems to return me to the first editor.

Locations of shortcuts (View Menu and dock bar)

Solution 3

Ctrl + TAB pops up the Switcher dialog. You can then either use repeated Ctrl+Tab to navigate to the window you want, or hit the corresponding number.

Solution 4

To switch from Editor to Console: CTRL + SHIFT + TAB
To switch from Console to Editor: SHIFT + ESC

This works for me on Ubuntu 16.04

Solution 5

Based on the title of the question the answer seem to be simply: Alt+F12.

This is true both for Eclipse bindings and the default.

It moves from the editor to the console/terminal and back when pressing it again. The only downside I see is that the terminal closes when moving back to the editor, I would like to keep it open and only move the focus.

Share:
30,477
livinston
Author by

livinston

Updated on July 09, 2022

Comments

  • livinston
    livinston almost 2 years

    In general, I'd like to know the keyboard shortcut for navigating to multiple sections like the project structure, editor, console. I'm using eclipse keymap configuration in pycharm. I used to switch between different views in eclipse using [Ctrl + F7]. But that is not working in pycharm.

    I also used to use F12 to bring the focus back to the editor when the focus is on any other view. That is also not working in pycharm.

    Environment: Ubuntu 12.04 64bit.

  • ACyclic
    ACyclic over 8 years
    "You can toggle back to the last editor window by hitting escape" - very useful thanks, this isn't obvious!
  • arcseldon
    arcseldon over 8 years
    This is useful in general, but unfortunately doesn't help when trying to navigate between editor window and the python console (title for this post by OP). The python console is listed in View -> Tool Windows but has no keyboard shortcut assigned. Am checking whether a custom keyboard shortcut can be assigned to make this work.
  • arcseldon
    arcseldon over 8 years
    This is the correct answer to the titled post "Keyboard shortcut to switch between python console and the editor in pycharm".
  • arcseldon
    arcseldon over 8 years
    Yes, can be done following the instructions provided in answer by @jafelds It is not required to bring up the View -> Tool Windows pane, you can just use whatever you map as the keyboard shortcut to Python Console, and use escape to return to Editor window
  • Dorku
    Dorku over 8 years
    This is the correct answer, Change View doesn't help you in navigating to Python Console.
  • Baris Demiray
    Baris Demiray almost 8 years
    This should be the accepted answer. Closure of the console window is not necessarily a downside, it leaves you more space with the editor.
  • WestCoastProjects
    WestCoastProjects over 7 years
    @arcseldon This is the correct answer. The python console is a flavor of run and alt [/opt]-4 performs the correct navigation
  • arcseldon
    arcseldon over 7 years
    @javadba - to be honest, i cannot even remember leaving those comments 16 months ago :) Thanks for taking the time to reply - incidentally, which version of pycharm are you referring to? Been using webtstorm and intellij for the past year only - there's definitely been lots of updates and bug fixes in the interim.
  • WestCoastProjects
    WestCoastProjects over 7 years
    Using intellij not pycharm as well. I just wanted to affirm this answer as being correct: since there are many alternates flying around.
  • WestCoastProjects
    WestCoastProjects almost 7 years
    alt-4 avoids the downside - it does exactly what is needed w/o side effects
  • Sudipta Basak
    Sudipta Basak almost 7 years
    This is what I was looking for many years. Alt + F12 and then esc worked to switch back and forth after the terminal override change.
  • flow2k
    flow2k over 5 years
    You can also toggle back to editor by pressing the same Python Console key you assigned.
  • 8forty
    8forty over 5 years
    this switches to the "Terminal" instead of the Python Console for me
  • divenex
    divenex about 5 years
    This works for the terminal, not for the "Python console" as asked.
  • Bob
    Bob almost 5 years
    Somehow a newly assigned shortcut does get the "Python console" focused, but Pycharm does not allow me to type directly. Toggling the "show variables" window fixed the issue.
  • flow2k
    flow2k about 4 years
    @Bob I see this too, and think it's a bug. Closing the console and starting anew helps.
  • Lucas925
    Lucas925 almost 4 years
    Wrong. Console != Terminal.