Skip to content

Instantly share code, notes, and snippets.

@steelcowboy
Created October 7, 2017 01:03
Show Gist options
  • Save steelcowboy/afcf344591658d2dc8148f3bec85ec01 to your computer and use it in GitHub Desktop.
Save steelcowboy/afcf344591658d2dc8148f3bec85ec01 to your computer and use it in GitHub Desktop.
VS Code -- Caps Lock to Backspace
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "capslock",
"command": "replacePreviousChar",
"args": {
"text": "",
"replaceCharCnt": 1},
"when": "editorTextFocus"
}
]
@steelcowboy
Copy link
Author

I noticed that, at least on Linux GNOME 3.26, Visual Studio Code uses the system keyboard layout -- with the exception of backspace not working. Digging through the sparse documentation on commands and looking at some code examples, I figured out that this config snippet will do to restore the functionality of the CapsLock key for other Colemak users!

@tropical32
Copy link

tropical32 commented Mar 9, 2018

It's good, but not perfect. Do you know how to remove a text that has been selected?

Edit:

[
    {
        "key": "capslock",
        "command": "deleteLeft",
        "when": "editorTextFocus && !editorReadonly" 
    }
]

@kajmagnus
Copy link

kajmagnus commented Aug 15, 2018

Hmm this maps to deleteLeft ... in the editor only, that's nice :- )
and I'm wondering, is there no way to map it to Backspace, always, in each and every situation.

(I'm using Vim mode & Colemak, so caps-lock/backspace could be useful in many many more cases)

Edit 1 month later, this works fine this far, with VSCode and Vim and Colemak:

        "key": "capslock",
        "command": "extension.vim_backspace",
        "when": "editorTextFocus && vim.active && !inDebugRepl"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment