Skip to content

Instantly share code, notes, and snippets.

@capsulecorplab
Last active June 10, 2019 08:46
Show Gist options
  • Select an option

  • Save capsulecorplab/81bc2786da69deacae8e5a48bf1cf073 to your computer and use it in GitHub Desktop.

Select an option

Save capsulecorplab/81bc2786da69deacae8e5a48bf1cf073 to your computer and use it in GitHub Desktop.
key bindings for vs code
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "capslock",
"command": "deleteLeft",
"when": "textInputFocus",
},
{
"key": "ctrl+pagedown",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus",
},
{
"key": "ctrl+pageup",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus",
},
{
"key": "ctrl+k",
"command": "asciidoc.showPreviewToSide",
"when": "editorTextFocus && editorLangId == 'asciidoc'",
},
{
"key": "ctrl+k",
"command": "markdown.showPreviewToSide",
"when": "editorTextFocus && editorLangId == 'markdown'",
},
{
"key": "ctrl+shift+c",
"command": "editor.action.clipboardCopyAction",
},
{
"key": "ctrl+shift+v",
"command": "editor.action.clipboardPasteAction",
},
{
"key": "ctrl+w",
"command": "workbench.action.closeActiveEditor",
},
{
"key": "ctrl+shift+w",
"command": "workbench.action.closeWindow",
},
]
#!/usr/bin/env python3
from pathlib import Path
from difflib import unified_diff
import traceback
def main():
home = str(Path.home())
with open(home + "/.config/Code/User/keybindings.json") as local:
s1 = local.read()
with open("keybindings.json") as upstream:
s2 = upstream.read()
try:
if len([_ for _ in unified_diff(s1, s2)]) > 0:
with open("keybindings.json", "w") as upstream:
upstream.write(s1)
print("keybindings.json updated. Changes ready for commit.")
elif len([_ for _ in unified_diff(s1, s2)]) == 0:
print("No changes made to keybindings.json.")
except Exception as e:
print(e)
if __name__ == "__main__":
main()
else:
raise Exception("must run as command-line script")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment