VS Code Keyboard Moves to Navigate Terminal Windows

These days I'm trying to keep my hands on the keyboard as much as possible. Here are some notes to remind myself how to get around the VS Code interface between code editing panes and terminal windows.

Custom Keybinding to Toggle from Code Pane to Terminal Window

I added this JSON snippet (found somewhere on the Internet, thank you kind stranger) to the VS Code keybindings file. Here is how I did it:

Open the VS Code keybindings JSON file for editing with ctrl+shift+p > Preferences: Open Keyboard Shortcuts (JSON)

Add the following to the file:

[
    {
	"key": "ctrl+;",
	"command": "workbench.action.focusActiveEditorGroup",
	"when": "terminalFocus"
    },
]

Now the ctrl+; key combination smoothly toggles from the code pane to the terminal window/s.

Using Built-In VS Code Keyboard Shortcuts for Terminal Window Navigation

VS Code provides excellent documentation for using the intergated terminal and clear instructions for the defaul keyboard shortcuts to navigate multiple terminals.

From One Group to Another

Navigate between terminal groups using focus next Ctrl+PageDown and focus previous Ctrl+PageUp.

From One Terminal to Another in a Group

Navigate between terminals in a group by focusing the previous pane, Alt+Left, and focusing the next pane, Alt+Right.

Customizing Keybindings for VIM-like Motion across Terminal Groups

Adding this code snippet to VS Code keybindings allows for VIM-like motion keyboard shortcuts to move from one split terminal to the next, and back.

Open the VS Code keybindings JSON file for editing with ctrl+shift+p > Preferences: Open Keyboard Shortcuts (JSON)

[
    {
        "key": "ctrl+shift+j",
	"command": "workbench.action.terminal.focusNext"
    },
    {
	"key": "ctrl+shift+k",
	"command": "workbench.action.terminal.focusPrevious"
    },
]

The VIM paragdigm breaks down at the bottom or top of the terminal group, because VS Code will just loop back to the beginning. Oh well.

Handy Django Test Command Examples

Quick reference of the syntax for running different Django test commands. These were scooped from the excellent book Practical Django 2 and Channels 2 by Federico Marani

$ # Run all the views tests
$ ./manage.py test main.tests.test_views.TestPage

$ # Run the homepage test (specific test run)
$ ./manage.py test main.tests.test_views.TestPage.test_home_page_works

$ # Run all the tests
$ ./mange.py test

PRO TIPS:

--keepdb to keep test db between runs
--failfast to stop tests at first failure