Control VS Code from the terminal. Open files, run commands, manage extensions, use the integrated terminal, interact with Copilot, and automate editor tasks. Use when a user asks FRIDAY to work with VS Code, edit files, or run VS Code commands.
Control Visual Studio Code from the command line. Open files, run commands, manage extensions, and automate editor tasks.
code /path/to/file.txt
code ~/project/src/main.py
code --goto /path/to/file.txt:42
code -g /path/to/file.txt:42:10 # line 42, column 10
code /path/to/project
code . # Current directory
code -n /path/to/project
code --new-window /path/to/file.txt
code -r /path/to/file.txt
code --reuse-window /path/to/project
code file1.py file2.py file3.py
code --diff file1.txt file2.txt
code -d original.py modified.py
code --new-file
echo "print('Hello World')" | code -
touch ~/project/newfile.py && code ~/project/newfile.py
cat > /tmp/script.py << 'EOF'
#!/usr/bin/env python3
def main():
print("Hello from Friday!")
if __name__ == "__main__":
main()
EOF
code /tmp/script.py
sed -i 's/old_text/new_text/g' file.txt && code file.txt
code --command "workbench.action.toggleSidebarVisibility"
code --command "editor.action.formatDocument"
code --command "workbench.action.files.save"
# File operations
code --command "workbench.action.files.save"
code --command "workbench.action.files.saveAll"
code --command "workbench.action.closeActiveEditor"
code --command "workbench.action.closeAllEditors"
# Editor actions
code --command "editor.action.formatDocument"
code --command "editor.action.commentLine"
code --command "editor.action.selectAll"
# View/UI
code --command "workbench.action.toggleSidebarVisibility"
code --command "workbench.action.togglePanel"
code --command "workbench.action.toggleZenMode"
code --command "workbench.action.toggleFullScreen"
# Search
code --command "workbench.action.findInFiles"
code --command "editor.action.startFindReplaceAction"
# Git
code --command "git.commit"
code --command "git.push"
code --command "git.pull"
code --command "git.sync"
code --command "workbench.action.terminal.new"
First open VS Code, then use xdotool to type in terminal:
code /path/to/project
sleep 2
# Open terminal
xdotool key ctrl+grave
sleep 0.5
# Type command
xdotool type "npm install"
xdotool key Return
code --command "workbench.action.tasks.runTask"
code --list-extensions
code --list-extensions --show-versions
code --install-extension ms-python.python
code --install-extension esbenp.prettier-vscode
code --install-extension GitHub.copilot
code --install-extension ms-python.python \
--install-extension ms-toolsai.jupyter \
--install-extension GitHub.copilot
code --uninstall-extension extension.id
code --disable-extensions
code --install-extension /path/to/extension.vsix
code --list-extensions | grep -i copilot
# If not installed:
code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat
code --command "workbench.action.chat.open"
code --command "editor.action.inlineSuggest.trigger"
code --command "editor.action.inlineSuggest.commit"
# Open VS Code first, then:
xdotool key ctrl+shift+i # Open Copilot Chat (may vary)
code --command "workbench.action.openSettings"
code ~/.config/Code/User/settings.json
code ~/.config/Code/User/keybindings.json
code --list-extensions > ~/vscode-extensions.txt
cat ~/vscode-extensions.txt | xargs -L 1 code --install-extension
code project.code-workspace
code --command "workbench.action.findInFiles"
code --command "workbench.action.quickOpen"
code --command "workbench.action.gotoSymbol"
code --command "workbench.action.gotoLine"
# Find and open first match
FILE=$(rg -l "search_term" | head -1) && code "$FILE"
# Find line number and open at that line
RESULT=$(rg -n "search_term" | head -1)
FILE=$(echo "$RESULT" | cut -d: -f1)
LINE=$(echo "$RESULT" | cut -d: -f2)
code -g "$FILE:$LINE"
code --command "workbench.action.debug.start"
code --command "workbench.action.debug.stop"
code --command "editor.debug.action.toggleBreakpoint"
code --command "workbench.action.debug.stepOver"
code --command "workbench.action.debug.stepInto"
code --command "workbench.action.debug.stepOut"
code --command "workbench.view.scm"
code --command "git.stageAll"
code --command "git.commit"
code --command "git.push"
code --command "git.pull"
code --command "git.sync"
code --command "git.viewHistory"
wmctrl -a "Visual Studio Code"
wmctrl -a "Visual Studio Code" && sleep 0.3 && scrot -u ~/Pictures/vscode-$(date +%Y%m%d-%H%M%S).png
wmctrl -a "Visual Studio Code"
sleep 0.3
xdotool type "// This is a comment"
wmctrl -a "Visual Studio Code"
xdotool key ctrl+s
wmctrl -a "Visual Studio Code"
xdotool key ctrl+shift+p
sleep 0.3
xdotool type "Format Document"
xdotool key Return
PROJECT=~/myproject
mkdir -p "$PROJECT/src"
cat > "$PROJECT/src/utils.py" << 'EOF'
def helper():
pass
EOF
code "$PROJECT/src/utils.py"
code ~/project && cd ~/project && npm install
PROJECT=~/new-python-project
mkdir -p "$PROJECT"/{src,tests,docs}
touch "$PROJECT/src/__init__.py"
touch "$PROJECT/tests/__init__.py"
echo "# My Project" > "$PROJECT/README.md"
code "$PROJECT"
code ~/project
sleep 2
code --command "workbench.action.terminal.new"
xclip -selection clipboard -o > /tmp/from-clipboard.txt && code /tmp/from-clipboard.txt
pgrep -f "code-server" && echo "Running" || echo "Not running"
code --status
code --version
code --verbose --log debug