Skip to content

Instantly share code, notes, and snippets.

@luiarthur
Last active April 10, 2024 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luiarthur/7ff47a9a0d213146a6f68bef460c7bfb to your computer and use it in GitHub Desktop.
Save luiarthur/7ff47a9a0d213146a6f68bef460c7bfb to your computer and use it in GitHub Desktop.
VSCode map `ctrl-j` to send line down
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+shift+h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl+shift+l",
"command": "workbench.action.navigateRight"
},
{
"key": "ctrl+shift+k",
"command": "workbench.action.navigateUp"
},
{
"key": "ctrl+shift+j",
"command": "workbench.action.navigateDown"
},
{
"key": "ctrl+j",
"command": "runCommands",
"args": {
"commands": [
"workbench.action.terminal.runSelectedText",
"cursorDown",
]
},
"when": "editorTextFocus"
},
{
// Source current python script.
"key": "ctrl+h",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "exec(open('${file}').read())\u000D" },
"when": "editorTextFocus && editorLangId == 'python'"
},
{
// Source current julia script.
"key": "ctrl+h",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "include(\"${file}\")\u000D" },
"when": "editorTextFocus && editorLangId == 'julia'"
},
{
// Source current R script.
"key": "ctrl+h",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "source(\"${file}\")\u000D" },
"when": "editorTextFocus && editorLangId == 'r'"
},
{
"key": "ctrl+shift+enter",
"command": "notebook.cell.executeCellAndBelow",
"when": "notebookCellListFocused || editorTextFocus && inputFocus && notebookEditorFocused"
},
]
// Place in settings.json. Do this from the vs code GUI.
{
"editor.minimap.enabled": false,
"editor.cursorStyle": "block",
"terminal.integrated.commandsToSkipShell": [
"language-julia.interrupt"
],
"julia.symbolCacheDownload": true,
"julia.enableTelemetry": false,
"remote.SSH.configFile": "/Users/alui/.ssh/vscode-config",
"quarto.mathjax.theme": "dark",
"files.associations": {
"*.rmd": "markdown"
},
"vim.cursorStylePerMode.insert": "line",
"editor.fontSize": 16
}
@luiarthur
Copy link
Author

luiarthur commented Sep 20, 2022

Custom keybindings

Add the first script to keybindings.json, which can be accessed by:
VSCode Menu -> Code -> Keyboard Shortcuts -> Open Keyboard Shortcuts (JSON) in top right corner

Resources:


Custom settings

Similarly, settings.json can be accessed by
VSCode Menu -> Code -> Settings -> Open Settings (JSON) in top right corner

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