skip to Main Content

I am new with python and VS Code and I wanted to ask if there is a shortcut with which you can jump directly to the terminal when you are asked for an input. I find it annoying that I have to go to the terminal with my mouse every time when asked for an input. It would be perfect if I could just type as soon as I run the program.

I started with coding in the python playground at programiz.pro and there would pop up a input window where you could directly type in your input without moving your cursor.

I’m new to VS Code so I searched for a solution on the internet but haven’t found one yet.

2

Answers


  1. I don’t know if there is a shortcut for that either but you may open a terminal in a new window so that you can just switch between the windows with alt + tab. Hope that helps.

    Login or Signup to reply.
  2. A similar problem has an answer already on Super User. This seems to be something that you can configure in your settings. It may be possible (either natively or through an extension) to configure one hotkey to have two effects, i.e. to first run the program, and then move the cursor to the terminal window.

    The relevant portion of the Super User answer is copied below, using the shortcut CTRL+k to move the cursor to the terminal, and CTRL+j to move the cursor (back) to the editor when you’re done:


    {
      "key": "ctrl+j",
      "command": "workbench.action.focusActiveEditorGroup",
      "when": "!terminalFocus"
    },
    {
      "key": "ctrl+k",
      "command": "workbench.action.terminal.focus",
      "when": "terminalFocus"
    }
    

    Step to configure:

    1. Go to: File > Preferences > keyboard shortcuts
    2. Then in the search-bar, search for focus terminal
    3. Select workbench.action.terminal.focus and then CTRL+k or press your custom key and then press enter.
    4. Similarly, in the search-bar search for focus active editor group
    5. Select workbench.action.focusActiveEditorGroup and then press CTRL+j or press your custom key and then press enter.

    After the above setup:

    • Press CTRL+k to focus cursor on terminal
    • Press CTRL+j to focus cursor on coding section without closing terminal
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search