diff --git a/hosts/duskfall/home.nix b/hosts/duskfall/home.nix index 56a761f2..b78bb65c 100644 --- a/hosts/duskfall/home.nix +++ b/hosts/duskfall/home.nix @@ -15,7 +15,8 @@ # programs browser = "qutebrowser"; brave.enable = true; - editor = "emacs"; + editor = "vscodium"; + emacs.enable = true; ranger.enable = true; yazi.enable = true; git.enable = true; diff --git a/hosts/snowfire/home.nix b/hosts/snowfire/home.nix index c89dc0be..790b424d 100644 --- a/hosts/snowfire/home.nix +++ b/hosts/snowfire/home.nix @@ -15,7 +15,8 @@ # programs browser = "qutebrowser"; brave.enable = true; - editor = "emacs"; + editor = "vscodium"; + emacs.enable = true; ranger.enable = true; yazi.enable = true; git.enable = true; diff --git a/hosts/stardust/home.nix b/hosts/stardust/home.nix index 055dc963..4c55d077 100644 --- a/hosts/stardust/home.nix +++ b/hosts/stardust/home.nix @@ -14,7 +14,7 @@ # programs browser = "brave"; - editor = "kate"; + editor = "vscodium"; ranger.enable = true; yazi.enable = true; git.enable = true; diff --git a/hosts/zenith/home.nix b/hosts/zenith/home.nix index f4dffd95..1b5648ec 100644 --- a/hosts/zenith/home.nix +++ b/hosts/zenith/home.nix @@ -14,7 +14,8 @@ # programs browser = "qutebrowser"; brave.enable = true; - editor = "emacs"; + editor = "vscodium"; + emacs.enable = true; ranger.enable = true; yazi.enable = true; git.enable = true; @@ -42,7 +43,7 @@ }; home.packages = with pkgs; [ - openldap ldapvi + openldap ldapvi rclone teams-for-linux ]; home.sessionVariables = lib.mkIf config.userSettings.hyprland.enable { diff --git a/modules/user/editor/default.nix b/modules/user/editor/default.nix index 3aa64c21..b80abd62 100644 --- a/modules/user/editor/default.nix +++ b/modules/user/editor/default.nix @@ -6,9 +6,9 @@ let in { options = { userSettings.editor = lib.mkOption { - default = "emacs"; + default = "vscodium"; description = "Default editor"; - type = lib.types.enum [ "emacs" "kate" ]; + type = lib.types.enum [ "emacs" "kate" "vscodium" ]; # TODO add more editors #type = lib.types.enum [ "emacs" "vim" "nvim" "neovide" "nano" "micro" "vscodium" "kate" "pulsar" ]; }; @@ -20,13 +20,25 @@ in { config = { userSettings.emacs.enable = lib.mkIf (config.userSettings.editor == "emacs") true; + userSettings.vscodium.enable = lib.mkIf (config.userSettings.editor == "vscodium") true; home.packages = with pkgs; lib.optionals (editor == "kate") [ kdePackages.kate]; userSettings.spawnEditor = lib.mkMerge [ (lib.mkIf (editor == "emacs") "emacsclient -c -a 'emacs'") (lib.mkIf (editor == "neovide") "neovide -- --listen /tmp/nvimsocket") + (lib.mkIf (editor == "vscodium") "codium -n") (lib.mkIf (builtins.elem editor [ "vim" "nvim" "nano" "micro" ]) ("exec " + term + " -e " + editor)) - (lib.mkIf (!(builtins.elem editor [ "emacs" "vim" "nvim" "neovide" "nano" "micro"])) editor) + (lib.mkIf (!(builtins.elem editor [ "emacs" "vim" "nvim" "neovide" "nano" "micro" "vscodium"])) editor) ]; + home.sessionVariables = { + EDITOR = + lib.mkMerge [ + (lib.mkIf (editor == "emacs") "emacsclient -c") + (lib.mkIf (editor == "neovide") "neovide -- --listen /tmp/nvimsocket") + (lib.mkIf (editor == "vscodium") "codium -n") + (lib.mkIf (builtins.elem editor [ "vim" "nvim" "nano" "micro" ]) ("exec " + term + " -e " + editor)) + (lib.mkIf (!(builtins.elem editor [ "emacs" "vim" "nvim" "neovide" "nano" "micro" "vscodium" ])) editor) + ]; + }; }; } diff --git a/modules/user/engineering/default.nix b/modules/user/engineering/default.nix index 4c371fa5..9b692bbd 100644 --- a/modules/user/engineering/default.nix +++ b/modules/user/engineering/default.nix @@ -17,8 +17,8 @@ in { cura-appimage arduino-ide graphviz - vscodium-fhs ]; + userSettings.vscodium.enable = true; xdg.desktopEntries.cura = lib.mkForce { name = "Ultimaker Cura"; genericName = "3D Printing Software"; diff --git a/modules/user/vscodium/default.nix b/modules/user/vscodium/default.nix new file mode 100644 index 00000000..6273a1e1 --- /dev/null +++ b/modules/user/vscodium/default.nix @@ -0,0 +1,95 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.userSettings.vscodium; +in { + options = { + userSettings.vscodium = { + enable = lib.mkEnableOption "Enable vscodium"; + }; + }; + + config = lib.mkIf cfg.enable { + programs.vscode = { + enable = true; + package = pkgs.vscodium; + profiles.default.extensions = with pkgs.vscode-extensions; [ + vscodevim.vim + kahole.magit + jnoortheen.nix-ide + mkhl.direnv + geequlim.godot-tools + yzhang.markdown-all-in-one + ]; + profiles.default.userSettings = { + "keyboard.dispatch" = "keyCode"; + }; + profiles.default.keybindings = [ + { + "key" = "g g"; + "command" = "cursorTop"; + "when" = "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" ; + } + { "key" = "g r"; + "command" = "magit.refresh"; + "when" = "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" ; + } + { + "key" = "tab"; + "command" = "extension.vim_tab"; + "when" = "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert' && editorLangId != 'magit'"; + } + { + "key" = "tab"; + "command" = "-extension.vim_tab"; + } + { + "key" = "x"; + "command" = "magit.discard-at-point"; + "when" = "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"; + } + { + "key" = "k"; + "command" = "-magit.discard-at-point"; + } + { + "key" = "-"; + "command" = "magit.reverse-at-point"; + "when" = "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"; + } + { + "key" = "v"; + "command" = "-magit.reverse-at-point"; + } + { + "key" = "shift+-"; + "command" = "magit.reverting"; + "when" = "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"; + } + { + "key" = "shift+v"; + "command" = "-magit.reverting"; + } + { + "key" = "shift+o"; + "command" = "magit.resetting"; + "when" = "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"; + } + { + "key" = "shift+x"; + "command" = "-magit.resetting"; + } + { + "key" = "x"; + "command" = "-magit.reset-mixed"; + } + { + "key" = "ctrl+u x"; + "command" = "-magit.reset-hard"; + } + ]; + mutableExtensionsDir = false; + + }; + stylix.targets.vscode.enable = true; + }; +}