diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index 58d3b51..0202dfe 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -52,6 +52,7 @@ ./roles/lvfs ./roles/nvme ./roles/terraform + ./roles/vscode ]; nix.settings.experimental-features = [ diff --git a/nix/configuration/roles/vscode/default.nix b/nix/configuration/roles/vscode/default.nix new file mode 100644 index 0000000..a00bbbe --- /dev/null +++ b/nix/configuration/roles/vscode/default.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + config = lib.mkIf config.me.graphical { + allowedUnfree = [ + "vscode" + "vscode-with-extensions" + "vscode-extension-ms-vscode-remote-remote-ssh" + ]; + + environment.systemPackages = with pkgs; [ + (vscode-with-extensions.override { + vscodeExtensions = with vscode-extensions; [ + bbenoist.nix + ms-python.python + ms-azuretools.vscode-docker + ms-vscode-remote.remote-ssh + ] + # ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + # { + # name = "remote-ssh-edit"; + # publisher = "ms-vscode-remote"; + # version = "0.47.2"; + # sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; + # } + # ] + ; + }) + ]; + + home-manager.users.talexander = + { pkgs, ... }: + { + home.file.".config/Code/User/settings.json" = { + source = ./files/settings.json; + }; + home.file.".config/Code/User/keybindings.json" = { + source = ./files/keybindings.json; + }; + }; + }; +} diff --git a/nix/configuration/roles/vscode/files/keybindings.json b/nix/configuration/roles/vscode/files/keybindings.json new file mode 100644 index 0000000..ec56007 --- /dev/null +++ b/nix/configuration/roles/vscode/files/keybindings.json @@ -0,0 +1,280 @@ +// Place your key bindings in this file to override the defaultsauto[] +[ + { + "key": "alt+.", + "command": "editor.action.revealDefinition", + "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor" + }, + { + "key": "f12", + "command": "-editor.action.revealDefinition", + "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor" + }, + { + "key": "alt+,", + "command": "workbench.action.navigateBack", + "when": "canNavigateBack" + }, + { + "key": "ctrl+alt+-", + "command": "-workbench.action.navigateBack", + "when": "canNavigateBack" + }, + { + "key": "shift+alt+/", + "command": "editor.action.goToReferences", + "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor" + }, + { + "key": "shift+f12", + "command": "-editor.action.goToReferences", + "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor" + }, + { + "key": "ctrl+alt+.", + "command": "workbench.action.showAllSymbols" + }, + { + "key": "ctrl+t", + "command": "-workbench.action.showAllSymbols" + }, + { + "key": "alt+;", + "command": "editor.action.commentLine", + "when": "editorTextFocus && !editorReadonly" + }, + { + "key": "ctrl+/", + "command": "-editor.action.commentLine", + "when": "editorTextFocus && !editorReadonly" + }, + { + "key": "ctrl+x", + "command": "-editor.action.clipboardCutAction" + }, + { + "key": "ctrl+x", + "command": "-filesExplorer.cut", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { + "key": "ctrl+x 3", + "command": "workbench.action.splitEditor" + }, + { + "key": "ctrl+\\", + "command": "-workbench.action.splitEditor" + }, + { + "key": "ctrl+x 2", + "command": "workbench.action.splitEditorDown" + }, + { + "key": "ctrl+k ctrl+\\", + "command": "-workbench.action.splitEditorDown" + }, + { + "key": "ctrl+x 1", + "command": "workbench.action.joinAllGroups" + }, + { + "key": "ctrl+x 0", + "command": "workbench.action.closeEditorsAndGroup" + }, + { + "key": "ctrl+x shift+=", + "command": "workbench.action.evenEditorWidths" + }, + { + "key": "shift+up", + "command": "workbench.action.focusAboveGroup" + }, + { + "key": "ctrl+k ctrl+up", + "command": "-workbench.action.focusAboveGroup" + }, + { + "key": "shift+down", + "command": "workbench.action.focusBelowGroup" + }, + { + "key": "ctrl+k ctrl+down", + "command": "-workbench.action.focusBelowGroup" + }, + { + "key": "shift+left", + "command": "workbench.action.focusLeftGroup" + }, + { + "key": "ctrl+k ctrl+left", + "command": "-workbench.action.focusLeftGroup" + }, + { + "key": "shift+right", + "command": "workbench.action.focusRightGroup" + }, + { + "key": "ctrl+k ctrl+right", + "command": "-workbench.action.focusRightGroup" + }, + { + "key": "ctrl+x ctrl+s", + "command": "workbench.action.files.save" + }, + { + "key": "ctrl+s", + "command": "-workbench.action.files.save" + }, + { + "key": "alt+g g", + "command": "workbench.action.gotoLine" + }, + { + "key": "ctrl+g", + "command": "-workbench.action.gotoLine" + }, + { + "key": "ctrl+space", + "command": "editor.action.setSelectionAnchor", + "when": "editorTextFocus" + }, + { + "key": "ctrl+k ctrl+b", + "command": "-editor.action.setSelectionAnchor", + "when": "editorTextFocus" + }, + { + "key": "alt+w", + "command": "editor.action.clipboardCopyAction" + }, + { + "key": "ctrl+c", + "command": "-editor.action.clipboardCopyAction" + }, + { + "key": "ctrl+w", + "command": "editor.action.clipboardCutAction" + }, + { + "key": "ctrl+y", + "command": "editor.action.clipboardPasteAction" + }, + { + "key": "ctrl+v", + "command": "-editor.action.clipboardPasteAction" + }, + { + "key": "ctrl+x p f", + "command": "workbench.action.quickOpen" + }, + { + "key": "ctrl+e", + "command": "-workbench.action.quickOpen" + }, + { + "key": "ctrl+a", + "command": "cursorLineStart" + }, + { + "key": "ctrl+e", + "command": "cursorLineEnd" + }, + { + "key": "ctrl+s", + "command": "actions.find", + "when": "editorFocus || editorIsOpen" + }, + { + "key": "ctrl+f", + "command": "-actions.find", + "when": "editorFocus || editorIsOpen" + }, + { + "key": "ctrl+shift+-", + "command": "undo" + }, + { + "key": "ctrl+z", + "command": "-undo" + }, + { + "key": "alt+x", + "command": "workbench.action.showCommands" + }, + { + "key": "ctrl+shift+p", + "command": "-workbench.action.showCommands" + }, + { + "key": "ctrl+c ctrl+a", + "command": "editor.action.quickFix", + "when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly" + }, + { + "key": "ctrl+.", + "command": "-editor.action.quickFix", + "when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly" + }, + { + "key": "shift+alt+5", + "command": "editor.action.startFindReplaceAction", + "when": "editorFocus || editorIsOpen" + }, + { + "key": "ctrl+h", + "command": "-editor.action.startFindReplaceAction", + "when": "editorFocus || editorIsOpen" + }, + { + "key": "shift+1", + "command": "editor.action.replaceAll", + "when": "editorFocus && findWidgetVisible" + }, + { + "key": "ctrl+alt+enter", + "command": "-editor.action.replaceAll", + "when": "editorFocus && findWidgetVisible" + }, + { + "key": "shift+alt+,", + "command": "cursorTop", + "when": "textInputFocus" + }, + { + "key": "ctrl+home", + "command": "-cursorTop", + "when": "textInputFocus" + }, + { + "key": "shift+alt+.", + "command": "cursorBottom", + "when": "textInputFocus" + }, + { + "key": "ctrl+end", + "command": "-cursorBottom", + "when": "textInputFocus" + }, + { + "key": "ctrl+x ctrl+f", + "command": "workbench.action.files.openFile", + "when": "true" + }, + { + "key": "ctrl+o", + "command": "-workbench.action.files.openFile", + "when": "true" + }, + { + "key": "ctrl+x k", + "command": "workbench.action.closeEditorInAllGroups" + }, + { + "key": "ctrl+x b", + "command": "workbench.action.showAllEditors" + }, + { + "key": "ctrl+k ctrl+p", + "command": "-workbench.action.showAllEditors" + } +] diff --git a/nix/configuration/roles/vscode/files/settings.json b/nix/configuration/roles/vscode/files/settings.json new file mode 100644 index 0000000..94f03fc --- /dev/null +++ b/nix/configuration/roles/vscode/files/settings.json @@ -0,0 +1,41 @@ +{ + "application.shellEnvironmentResolutionTimeout": 90, + "workbench.colorTheme": "Default High Contrast", + "remote.SSH.connectTimeout": 90, + "remote.SSH.enableDynamicForwarding": false, + "remote.SSH.enableAgentForwarding": false, + "remote.SSH.enableX11Forwarding": false, + "python.analysis.inlayHints.functionReturnTypes": true, + "python.analysis.inlayHints.variableTypes": true, + "editor.minimap.enabled": false, + "editor.fontSize": 12, + "editor.cursorStyle": "block", + "editor.fontFamily": "'Cascadia Mono', 'monospace', monospace", + "workbench.colorCustomizations": { + "editorCursor.foreground": "#ccff66", + "terminalCursor.foreground": "#ccff66" + }, + "workbench.editor.showTabs": "none", + "workbench.activityBar.location": "hidden", + "window.menuBarVisibility": "toggle", + "explorer.autoReveal": false, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true + }, + "[terraform]": { + "editor.defaultFormatter": "hashicorp.terraform", + "editor.formatOnSave": true + }, + "[terraform-vars]": { + "editor.defaultFormatter": "hashicorp.terraform", + "editor.formatOnSave": true + }, + "black-formatter.importStrategy": "fromEnvironment", + "workbench.statusBar.visible": false, + "git.openRepositoryInParentFolders": "never", + "files.autoSave": "afterDelay", + "editor.rulers": [ + 100 + ] +}