diff --git a/modules/programs/helix.nix b/modules/programs/helix.nix index 2e2f78c9..74b029c0 100644 --- a/modules/programs/helix.nix +++ b/modules/programs/helix.nix @@ -49,7 +49,8 @@ in default = false; description = '' Whether to configure {command}`hx` as the default - editor using the {env}`EDITOR` environment variable. + editor using the {env}`EDITOR` and {env}`VISUAL` + environment variables. ''; }; @@ -225,7 +226,10 @@ in else [ cfg.package ]; - home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "hx"; }; + home.sessionVariables = mkIf cfg.defaultEditor { + EDITOR = "hx"; + VISUAL = "hx"; + }; xdg.configFile = let diff --git a/modules/programs/kakoune.nix b/modules/programs/kakoune.nix index becc7519..ca8e8a58 100644 --- a/modules/programs/kakoune.nix +++ b/modules/programs/kakoune.nix @@ -705,7 +705,8 @@ in default = false; description = '' Whether to configure {command}`kak` as the default - editor using the {env}`EDITOR` environment variable. + editor using the {env}`EDITOR` and {env}`VISUAL` + environment variables. ''; }; @@ -755,7 +756,10 @@ in programs.kakoune.finalPackage = lib.mkIf (cfg.package != null) kakouneWithPlugins; home.packages = lib.mkIf (cfg.finalPackage != null) [ cfg.finalPackage ]; - home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "kak"; }; + home.sessionVariables = mkIf cfg.defaultEditor { + EDITOR = "kak"; + VISUAL = "kak"; + }; xdg.configFile = lib.mkMerge [ { "kak/kakrc".source = configFile; } (mkIf (cfg.colorSchemePackage != null) { diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index a234a133..271bc150 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -289,7 +289,8 @@ in default = false; description = '' Whether to configure {command}`nvim` as the default - editor using the {env}`EDITOR` environment variable. + editor using the {env}`EDITOR` and {env}`VISUAL` + environment variables. ''; }; @@ -453,7 +454,10 @@ in home.packages = [ cfg.finalPackage ]; - home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; }; + home.sessionVariables = mkIf cfg.defaultEditor { + EDITOR = "nvim"; + VISUAL = "nvim"; + }; home.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; }; diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix index 6773c878..5f919dfa 100644 --- a/modules/programs/vim.nix +++ b/modules/programs/vim.nix @@ -162,7 +162,8 @@ in default = false; description = '' Whether to configure {command}`vim` as the default - editor using the {env}`EDITOR` environment variable. + editor using the {env}`EDITOR` and {env}`VISUAL` + environment variables. ''; }; }; @@ -213,7 +214,10 @@ in home.packages = [ cfg.package ]; - home.sessionVariables = lib.mkIf cfg.defaultEditor { EDITOR = "vim"; }; + home.sessionVariables = lib.mkIf cfg.defaultEditor { + EDITOR = "vim"; + VISUAL = "vim"; + }; programs.vim = { package = vim; diff --git a/modules/services/emacs.nix b/modules/services/emacs.nix index 117c3b72..a7327199 100644 --- a/modules/services/emacs.nix +++ b/modules/services/emacs.nix @@ -113,7 +113,8 @@ in example = !default; description = '' Whether to configure {command}`emacsclient` as the default - editor using the {env}`EDITOR` environment variable. + editor using the {env}`EDITOR` and {env}`VISUAL` + environment variables. ''; }; }; @@ -121,11 +122,16 @@ in config = mkIf cfg.enable ( lib.mkMerge [ { - home.sessionVariables = mkIf cfg.defaultEditor { - EDITOR = lib.getBin ( - pkgs.writeShellScript "editor" ''exec ${lib.getBin cfg.package}/bin/emacsclient "''${@:---create-frame}"'' - ); - }; + home.sessionVariables = + let + editorBin = lib.getBin ( + pkgs.writeShellScript "editor" ''exec ${lib.getBin cfg.package}/bin/emacsclient "''${@:---create-frame}"'' + ); + in + mkIf cfg.defaultEditor { + EDITOR = editorBin; + VISUAL = editorBin; + }; } (mkIf pkgs.stdenv.isLinux {