mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
vim,neovim: set EDITOR to full binary path when defaultEditor
is used
Prior to this change the `EDITOR` variable was set only to the name of the program that should be looked up in `PATH` to use as the editor, but this will only work for user-level stuff, for stuff like `sudo -e` it won't work as the `PATH` will not contain the location of such programs. This makes it so that when the `defaultEditor` variable is set to `true` then `EDITOR` will point to the full binary location of the `vim` and `nvim` packages accordingly. This is similar to how we set `defaultEditor` in the Emacs module. This change is also made for `vim`.
This commit is contained in:
parent
d579633ff9
commit
6346c61b0c
2 changed files with 8 additions and 2 deletions
|
@ -390,7 +390,10 @@ in {
|
|||
|
||||
home.packages = [ cfg.finalPackage ];
|
||||
|
||||
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; };
|
||||
home.sessionVariables = mkIf cfg.defaultEditor {
|
||||
EDITOR = getBin
|
||||
(pkgs.writeShellScript "editor" "exec ${getBin cfg.package}/bin/nvim");
|
||||
};
|
||||
|
||||
xdg.configFile =
|
||||
let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs;
|
||||
|
|
|
@ -174,7 +174,10 @@ in {
|
|||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "vim"; };
|
||||
home.sessionVariables = mkIf cfg.defaultEditor {
|
||||
EDITOR = getBin
|
||||
(pkgs.writeShellScript "editor" "exec ${getBin cfg.package}/bin/vim");
|
||||
};
|
||||
|
||||
programs.vim = {
|
||||
package = vim;
|
||||
|
|
Loading…
Reference in a new issue