Skip to content

Instantly share code, notes, and snippets.

@tshort
Last active November 3, 2021 22:31
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 tshort/f5dc2495a274e28e4bb1e54f586f2f6b to your computer and use it in GitHub Desktop.
Save tshort/f5dc2495a274e28e4bb1e54f586f2f6b to your computer and use it in GitHub Desktop.
VSCodeVim / VSpaceCode extensions for using Julia in VS Code

Here are additions to keybindings.json to support more VIM-like keys in the plot pane. This could be a PR to julia-vscode.

            {
                "command": "language-julia.plotpane-previous",
                "key": "k",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.plotpane-next",
                "key": "j",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.plotpane-first",
                "key": "g g",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.plotpane-first",
                "key": "g k",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.plotpane-last",
                "key": "g j",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.plotpane-delete",
                "key": "d",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.copy-plot",
                "key": "y",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.save-plot",
                "key": "s",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "language-julia.plotpane-delete-all",
                "key": "shift+d",
                "when": "jlplotpaneFocus && !inputFocus"
            },
            {
                "command": "workbench.action.closeEditorsInGroup",
                "key": "escape",
                "when": "jlplotpaneFocus && !inputFocus"
            },

Here are additions to VSpaceCode in settings.json for a menu for Julia. This could be a PR to VSpaceCode.

									{
										"key": "languageId:julia",
										"name": "Julia",
										"type": "bindings",
										"bindings": [
											{
												"key": "x",
												"name": "Execute code in REPL (ctrl+Enter)",
												"icon": "play",
												"type": "command",
												"command": "language-julia.executeJuliaCodeInREPL",
											},
											{
												"key": "d",
												"name": "Show documentation",
												"icon": "book",
												"type": "command",
												"command": "language-julia.show-documentation"
											},
											{
												"key": "p",
												"name": "Show plots",
												"icon": "pulse",
												"type": "command",
												"command": "language-julia.show-plotpane",
											},
											{
												"key": "w",
												"name": "Focus on workspace view",
												"icon": "play",
												"type": "command",
												"command": "REPLVariables.focus",
											},
											{
												"key": "e",
												"name": "+Environment/package",
												"icon": "library",
												"type": "bindings",
												"bindings": [
													{
														"key": "a",
														"name": "Activate this environment",
														"icon": "check",
														"type": "command",
														"command": "language-julia.changeCurrentEnvironment"
													},
													{
														"key": "c",
														"name": "Change current environment",
														"icon": "issue-reopened",
														"type": "command",
														"command": "language-julia.changeCurrentEnvironment"
													},
													{
														"key": "p",
														"name": "Activate parent environment",
														"icon": "root-folder-opened",
														"type": "command",
														"command": "language-julia.changeCurrentEnvironment"
													},
													{
														"key": "m",
														"name": "Choose module",
														"icon": "symbol-variable",
														"type": "command",
														"command": "language-julia.chooseModule"
													},
													{
														"key": "p",
														"name": "Open package directory",
														"icon": "new-folder",
														"type": "command",
														"command": "language-julia.openPackageDirectory"
													},
													{
														"key": "t",
														"name": "Tag new package version (experimental)",
														"icon": "tag",
														"type": "command",
														"command": "language-julia.tagNewPackageVersion"
													},
												]
											},
											{
												"key": "=",
												"name": "+Format",
												"icon": "list-flat",
												"type": "bindings",
												"bindings": [
													{
														"key": "=",
														"name": "Format region or buffer",
														"icon": "list-flat",
														"type": "command",
														"command": "editor.action.format"
													},
													{
														"key": "b",
														"name": "Format buffer",
														"icon": "file",
														"type": "command",
														"command": "editor.action.formatDocument"
													},
													{
														"key": "c",
														"name": "Format changes",
														"icon": "diff",
														"type": "command",
														"command": "editor.action.formatChanges"
													},
													{
														"key": "s",
														"name": "Format selection",
														"icon": "selection",
														"type": "command",
														"command": "editor.action.formatSelection"
													},
													{
														"key": "B",
														"name": "+Format buffer with formatter",
														"icon": "file",
														"type": "command",
														"command": "editor.action.formatDocument.multiple"
													},
													{
														"key": "S",
														"name": "+Format selection with formatter",
														"icon": "selection",
														"type": "command",
														"command": "editor.action.formatSelection.multiple"
													}
												]
											},
											{
												"key": "b",
												"name": "+Backend",
												"icon": "circuit-board",
												"type": "bindings",
												"bindings": [
													{
														"key": "i",
														"icon": "output",
														"type": "command",
														"command": "language-julia.refreshLanguageServer",
														"name": "Julia: Re-Index Language Server Cache",
													},
													{
														"key": "r",
														"icon": "server-process",
														"type": "issue-reopened",
														"command": "language-julia.restartLanguageServer",
														"name": "Julia: Restart Language Server",
													},
													{
														"key": "R",
														"name": "Re-index language server cache",
														"icon": "checklist",
														"type": "command",
														"command": "language-julia.refreshLanguageServer"
													},
													{
														"key": "l",
														"name": "Toggle linter",
														"icon": "check",
														"type": "command",
														"command": "language-julia.toggleLinter"
													},
												]
											},
											{
												"key": "c",
												"name": "+Compile/debug",
												"icon": "play",
												"type": "bindings",
												"bindings": [
													{
														"key": "d",
														"name": "Debug file in new process",
														"icon": "debug-alt",
														"type": "command",
														"command": "language-julia.debugEditorContents"
													},
													{
														"key": "c",
														"name": "Switch all to compiled",
														"icon": "debug",
														"type": "command",
														"command": "language-julia.switchAllToCompiled"
													},
													{
														"key": "i",
														"name": "Switch all to interpreted",
														"icon": "run-below",
														"type": "command",
														"command": "language-julia.switchAllToInterpreted"
													},
													{
														"key": "x",
														"name": "Remove from compiled modules/functions",
														"icon": "diff-removed",
														"type": "command",
														"command": "language-julia.switchToInterpreted"
													},
													{
														"key": "a",
														"name": "Add to compiled modules/functions",
														"icon": "plus",
														"type": "command",
														"command": "language-julia.switchToCompiled"
													},
													{
														"key": "r",
														"name": "Refresh compiled/interpreted pane",
														"icon": "refresh",
														"type": "command",
														"command": "language-julia.refreshCompiled"
													},
													{
														"key": "A",
														"name": "Apply default compiled modules/functions",
														"icon": "diff-renamed",
														"type": "command",
														"command": "language-julia.apply-compiled-defaults"
													},
													{
														"key": "D",
														"name": "Clear compiled modules/functions",
														"icon": "diff-removed",
														"type": "command",
														"command": "language-julia.reset-compiled"
													},
													{
														"key": "Y",
														"name": "Add symbol to compiled modules/functions",
														"icon": "symbol-key",
														"type": "command",
														"command": "language-julia.set-compiled-for-name"
													},
													{
														"key": "F",
														"name": "Set current compiled modules/functions as default",
														"icon": "symbol-constant",
														"type": "command",
														"command": "language-julia.set-current-as-default-compiled"
													},
													{
														"key": "m",
														"name": "Enable compiled mode for the debugger",
														"icon": "debug-breakpoint-log",
														"type": "command",
														"command": "language-julia.enable-compiled-mode"
													},
													{
														"key": "M",
														"name": "Disable compiled mode for the debugger",
														"icon": "debug-breakpoint-unverified",
														"type": "command",
														"command": "language-julia.disable-compiled-mode"
													},
													{
														"key": "R",
														"name": "Restart kernel",
														"icon": "debug-restart",
														"type": "command",
														"command": "language-julia.restartKernel"
													},
													{
														"key": "S",
														"name": "Stop kernel",
														"icon": "debug-stop",
														"type": "command",
														"command": "language-julia.stopKernel"
													},
												]
											},
											{
												"key": "g",
												"name": "+Go to",
												"icon": "go-to-file",
												"type": "bindings",
												"bindings": [
													{
														"key": "d",
														"name": "Go to definition",
														"icon": "symbol-function",
														"type": "command",
														"command": "editor.action.revealDefinition"
													},
													{
														"key": "e",
														"name": "Go to errors/problems",
														"icon": "error",
														"type": "command",
														"command": "workbench.action.problems.focus"
													},
													{
														"key": "g",
														"name": "Go to definition",
														"icon": "symbol-function",
														"type": "command",
														"command": "editor.action.revealDefinition"
													},
													{
														"key": "r",
														"name": "Go to references",
														"icon": "symbol-reference",
														"type": "command",
														"command": "editor.action.goToReferences"
													},
													{
														"key": "s",
														"name": "Go to symbol in file",
														"icon": "file",
														"type": "command",
														"command": "workbench.action.gotoSymbol"
													},
													{
														"key": "R",
														"name": "Find references",
														"icon": "symbol-reference",
														"type": "command",
														"command": "references-view.findReferences"
													},
													{
														"key": "S",
														"name": "Go to symbol in project",
														"icon": "project",
														"type": "command",
														"command": "workbench.action.showAllSymbols"
													}
												]
											},
											{
												"key": "m",
												"name": "+Miscellaneous",
												"icon": "symbol-property",
												"type": "bindings",
												"bindings": [
													{
														"key": "c",
														"name": "Change directory here",
														"icon": "folder-opened",
														"type": "command",
														"command": "language-julia.cdHere"
													},
													{
														"key": "d",
														"name": "Clear сurrent inline results",
														"icon": "chrome-close",
														"type": "command",
														"command": "language-julia.clearCurrentInlineResult"
													},
													{
														"key": "D",
														"name": "Clear all inline results",
														"icon": "clear-all",
														"type": "command",
														"command": "language-julia.clearAllInlineResults"
													},
													{
														"key": "K",
														"name": "Clear all inline results in editor",
														"icon": "clear-all",
														"type": "command",
														"command": "language-julia.clearAllInlineResultsInEditor"
													},
												]
											},
											{
												"key": "s",
												"name": "+REPL",
												"icon": "repl",
												"type": "bindings",
												"bindings": [
													{
														"key": "i",
														"name": "Start REPL",
														"icon": "repl",
														"type": "command",
														"command": "language-julia.startREPL"
													},
													{
														"key": "D",
														"name": "Stop REPL",
														"icon": "stop",
														"type": "command",
														"command": "language-julia.stopREPL"
													},
													{
														"key": "C",
														"name": "Connect external REPL",
														"icon": "vm-connect",
														"type": "command",
														"command": "language-julia.connectREPL"
													},
													{
														"key": "s",
														"name": "Execute code in REPL (ctrl+Enter)",
														"icon": "play",
														"type": "command",
														"command": "language-julia.executeJuliaCodeInREPL"
													},
													{
														"key": "m",
														"name": "Execute code in REPL and move (alt+Enter)",
														"icon": "debug-continue",
														"type": "command",
														"command": "language-julia.executeCodeBlockOrSelectionAndMove"
													},
													{
														"key": "c",
														"name": "Execute code cell in REPL and move (shift+Enter)",
														"icon": "export",
														"type": "command",
														"command": "language-julia.executeCellAndMove"
													},
													{
														"key": "b",
														"name": "Execute block or selection in REPL",
														"icon": "selection",
														"type": "command",
														"command": "language-julia.executeCodeBlockOrSelection"
													},
													{
														"key": "f",
														"name": "Execute file in REPL",
														"icon": "file",
														"type": "command",
														"command": "language-julia.executeFile"
													},
													{
														"key": "F",
														"name": "Execute active file in REPL",
														"icon": "file",
														"type": "command",
														"command": "language-julia.executeActiveFile"
													},
												]
											},
										]},
@tshort
Copy link
Author

tshort commented Nov 3, 2021

Here's what the VSpaceCode menus look like for the space - m key in a Julia buffer:

2021-11-03 18_09_55-t jl - tmp - Visual Studio Code

2021-11-03 18_10_04-t jl - tmp - Visual Studio Code

2021-11-03 18_10_17-t jl - tmp - Visual Studio Code

2021-11-03 18_10_28-t jl - tmp - Visual Studio Code

2021-11-03 18_09_08-t jl - tmp - Visual Studio Code

2021-11-03 18_10_43-t jl - tmp - Visual Studio Code

2021-11-03 18_10_55-t jl - tmp - Visual Studio Code

2021-11-03 18_11_03-t jl - tmp - Visual Studio Code

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