How can I change keyboard shortcut bindings in Visual Studio Code?

前端 未结 7 1908
暗喜
暗喜 2020-12-12 18:38

I am using the recently updated Visual Studio Code v0.10.1, and I am wondering what is the procedure to:

  • Remap a built in command\'s keyboard shortcut. For

相关标签:
7条回答
  • 2020-12-12 19:10

    If you want to change the advance settings of keyboard shortcut such as when then you can follow these steps:

    Update:(Thanks @phdoerfler for pointing it out that icon has changed)

    File->Preferences->Keyboard Shortcuts Click on icon on top right corner that says "Open Keyboard Shortcuts(JSON)" to open JSON version and place the keybinding.

    Image showing icon

    You can find this in Documentation here.

    0 讨论(0)
  • 2020-12-12 19:18

    I will not repeat others answers! And if like me! You get to install a mapping extension!

    My prefered is Visual studio keys map

    And the question would have been how you select it! How you change it ! Can we install multiples! And select between them!

    First here some useful links about key binding and shortcuts

    https://code.visualstudio.com/docs/getstarted/keybindings

    https://code.visualstudio.com/docs/getstarted/tips-and-tricks

    And before any, know that you can get to the keymaps extension by using the bottom left settings button for settings context menu! As in the picture bellow:

    or through file>Preferences>keymap

    Then you have to install one of the keymaps

    The thing to know is that it will take place and make the changes right away!

    What if you install another?

    The new one take over! Or some mix! I couldn't tell! And you may have problems!

    How you change from one to another?

    Remove the old ! remove the new one! And install it again! That's the way that i found it works! Disabling and reenabling didn't work!

    And better always let only one installed at a time!

    Unfortunitly as by Now 2020-05-08 no options to select between keys mapping exist!

    Undo a keymap

    Just remove! You may need to restart the editor!

    Restart the editor

    Also note that if you uninstalled all and reinstalled the one you want! And changes didn't take place! Close the editor and reopen it! That's help!

    I hope that's help and may be save you some searching time!

    And sure in the future we will have better handling! As vscode is just keeping getting more awesome and awesome! So an option to select and better handling will is expected to be added! And we will wait for it!

    0 讨论(0)
  • 2020-12-12 19:22

    Click File -> Preferences -> Keyboard shortcuts.

    Copy and paste from the first column shown to the second column, and change the shortcut.

    For example, here's the keybindings.json:

    // Place your key bindings in this file to overwrite the defaults
    [
        { "key": "ctrl+o",                "command": "workbench.action.files.openFile" },
    
        { "key": "ctrl+alt+k",            "command": "bookmarks.toggle",
                                         "when": "editorTextFocus" }
    
    ]
    

    0 讨论(0)
  • 2020-12-12 19:23
    1. Open Key Shortcuts from Preferences -> Keyboard Shortcuts
    2. Search for the action in search field
    3. Right click on one of the results and select "Show same keybindings"
    4. Delete the conflicting key binding!
    0 讨论(0)
  • 2020-12-12 19:24

    The way to open the JSON file changed yet again in a recent version.

    You need to click the middle of the three buttons in the tab bar.

    Of course, you only need to do that when the change you need to make isn't possible using the normal settings screen.

    0 讨论(0)
  • 2020-12-12 19:25

    On Windows:

    • go to File -> Preferences -> Keyboard shortcuts,
    • or press Ctrl+K, then Ctrl+S,
    • or edit %UserProfile%\AppData\Roaming\Code\User\keybindings.json file

    On Mac:

    • go to Code -> Preferences -> Keyboard shortcuts,
    • or press Cmd+K, then Cmd+S

    Keep in mind you can type things like shift ctrl c in the Search input in Keyboard Shortcuts panel to find commands by their keybindings.

    Here you can find documentation which among other stuff contains also information about what When conditions you can use.

    0 讨论(0)
提交回复
热议问题