Skip to content

Instantly share code, notes, and snippets.

@isaksky
Created June 1, 2023 20:26
Show Gist options
  • Save isaksky/94128cda6297e560dbe75650611993c1 to your computer and use it in GitHub Desktop.
Save isaksky/94128cda6297e560dbe75650611993c1 to your computer and use it in GitHub Desktop.
Calva Keybindings, WASD movement
[
// Disable crazy VSCode default bindings
{
"key": "ctrl+shift+w",
"command": "-workbench.action.closeWindow"
},
{
"key": "ctrl+w",
"command": "-workbench.action.closeActiveEditor"
},
// Paredit movement with WASD
{
"key": "ctrl+shift+w",
"command": "paredit.backwardUpSexp",
"when": "calva:replWindowActive || editorLangId == clojure && editorTextFocus && paredit:keyMap =~ /original|strict/"
},
{
"key": "ctrl+shift+d",
"command": "paredit.forwardSexpOrUp",
"when": "calva:replWindowActive || editorLangId == clojure && editorTextFocus && paredit:keyMap =~ /original|strict/"
},
{
"key": "ctrl+shift+a",
"command": "paredit.backwardSexpOrUp",
"when": "calva:replWindowActive || editorLangId == clojure && editorTextFocus && paredit:keyMap =~ /original|strict/"
},
{
"key": "ctrl+shift+s",
"command": "paredit.forwardDownSexp",
"when": "calva:replWindowActive || editorLangId == clojure && editorTextFocus && paredit:keyMap =~ /original|strict/"
},
// ----------------------------------
// Paredit manipulation with WASD
// ----------------------------------
// Useful for wrapping something e.g., `(when|) (do-something) ==> (when| (do-something))`
{
"key": "ctrl+alt+d",
"command": "paredit.slurpSexpForward",
"when": "calva:keybindingsEnabled && editorTextFocus && !calva:cursorInComment && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
},
// Useful for taking something out of a form. e.g., `(comment |(do-something!))` ==> `|(do-something!)`
{
"key": "ctrl+alt+w",
"command": "paredit.spliceSexpKillBackward",
"when": "calva:keybindingsEnabled && editorTextFocus && !calva:cursorInComment && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
},
// Nice to haves from cursive
{
"key": "ctrl+k",
"command": "paredit.killSexpForward",
"when": "calva:keybindingsEnabled && editorTextFocus && !calva:cursorInComment && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
},
{
"key": "ctrl+w",
"command": "paredit.sexpRangeExpansion",
"when": "calva:keybindingsEnabled && editorTextFocus && !calva:cursorInComment && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment