One of the many ways you can enhance your coding experience is by setting custom key bindings and configuring your terminal environment.
This post will guide you through the steps to:
- Set custom key bindings in VS Code
- Invoke VS Code from the terminal using the
code .
command - Modify the shell configuration in the integrated terminal
🔧 Setting Custom Key Bindings in Visual Studio Code
Custom key bindings allow you to execute commands faster and streamline your workflow. Here’s how you can configure key bindings for common tasks:
1. Run a Script (When Code Runner Is Enabled)
To assign a custom key combination to run your code using the Code Runner extension:
- Open Keyboard Shortcuts:
- Windows/Linux:
Ctrl + K
followed byCtrl + S
- macOS:
Cmd + K
followed byCmd + S
- Windows/Linux:
- In the search bar, type: code-runner.run
- Click the pencil icon next to the result or double-click the row.
- Enter your preferred key combination (e.g.,
Ctrl + Enter
) and press Enter to save.

2. Focus on Active Editor Group
If you often work with multiple editor panes, setting a shortcut to focus on the active editor group can boost efficiency.
- Open Keyboard Shortcuts:
Ctrl + K Ctrl + S
(Windows/Linux) orCmd + K Cmd + S
(macOS) - Search for:
workbench.action.focusActiveEditorGroup
- Edit the keybinding by clicking the pencil icon or double-clicking.
- Assign a shortcut like
Ctrl + e
and press Enter to save.

3. Focus on the Terminal
Quickly jumping to the terminal is essential in many development tasks.
- Open Keyboard Shortcuts.
- Search for:
workbench.action.terminal.focusAtIndex1
(You can change the index number to target a specific terminal instance.) - Click to edit the shortcut.
- Set your desired combination, such as
Ctrl + t
, then press Enter.

🖥️ How to Invoke VS Code from the Terminal Using “code.
“
Running code .
from the terminal allows you to open the current directory in VS Code—a must-have shortcut for developers.
Step-by-Step Setup
- Ensure that VS Code is installed in its default location:
- On macOS:
/Applications/Visual Studio.app
- On macOS:
- Launch VS Code from your system’s standard method (Applications folder, Start Menu, etc.).
- Open the Command Palette:
- macOS:
Cmd + Shift + P
- Windows/Linux:
Ctrl + Shift + P
- macOS:
- Search for and select:
Shell Command: Install 'code' command in PATH
- Follow the prompts. You may need to enter your administrator password.
- Important: Restart your terminal for the changes to take effect.
⚙️ Modifying Shell Configuration in the VS Code Terminal
Customizing your terminal prompt improves visibility and can personalize your development environment.
Steps to Modify Shell Configuration
- First, identify your shell by running:
echo $SHELL
- Edit your shell configuration file. For Zsh,
vim ~/.zshrc
- Add the following lines to customize the prompt:
MY_PROMPT="%1~ %{$fg[green]%}>%{$reset_color%} " PS1="$MY_PROMPT"
- Save the file and reload the terminal, or run
source ~/.zshrc
to apply the changes immediately.
By taking the time to set up these customizations, you can significantly improve your coding efficiency and tailor Visual Studio Code to your workflow. Whether it’s creating intuitive key bindings or invoking VS Code directly from your terminal, every adjustment helps make development faster and more enjoyable.
Leave a Reply