VS Code Shortcuts

Helper functions for coding on VS Code in the browser (vscode.dev)

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         VS Code Shortcuts
// @namespace    http://tampermonkey.com
// @version      1
// @description  Helper functions for coding on VS Code in the browser (vscode.dev)
// @match        https://*.vscode.dev/*
// @license      MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Add a shortcut to open the command palette
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.shiftKey && event.key === 'P') {
            document.querySelector('.command-palette').click();
        }
    });

    // Add a shortcut to toggle the sidebar
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.key === 'B') {
            document.querySelector('.activitybar .toggle-more').click();
        }
    });

    // Add a shortcut to toggle the terminal
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.key === '`') {
            document.querySelector('.panel-switcher .terminal').click();
        }
    });

    // Add a shortcut to toggle the output panel
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.altKey && event.key === 'O') {
            document.querySelector('.panel-switcher .output').click();
        }
    });

    // Add a shortcut to toggle the problems panel
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.altKey && event.key === 'P') {
            document.querySelector('.panel-switcher .problems').click();
        }
    });

    // Add a shortcut to toggle the search panel
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.shiftKey && event.key === 'F') {
            document.querySelector('.panel-switcher .search').click();
        }
    });

})();