1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-22 01:39:47 +01:00

vim,neovim: add defaultEditor (#3496)

Also rename `vim_configurable` to `vim-full` per https://github.com/NixOS/nixpkgs/pull/204438
This commit is contained in:
Naïm Favier 2022-12-29 22:36:05 +01:00 committed by GitHub
parent c8f6322303
commit dd99675ee8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

View file

@ -241,6 +241,15 @@ in {
description = "Resulting customized neovim package."; description = "Resulting customized neovim package.";
}; };
defaultEditor = mkOption {
type = types.bool;
default = false;
description = ''
Whether to configure <command>nvim</command> as the default
editor using the <envar>EDITOR</envar> environment variable.
'';
};
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
@ -372,6 +381,8 @@ in {
home.packages = [ cfg.finalPackage ]; home.packages = [ cfg.finalPackage ];
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; };
xdg.configFile = xdg.configFile =
let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs; let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs;
in mkMerge ( in mkMerge (

View file

@ -127,9 +127,19 @@ in {
packageConfigurable = mkOption { packageConfigurable = mkOption {
type = types.package; type = types.package;
description = "Configurable vim package"; description = "Vim package to customize";
default = pkgs.vim_configurable; default = pkgs.vim-full or pkgs.vim_configurable;
defaultText = "pkgs.vim_configurable"; defaultText = literalExpression "pkgs.vim-full";
example = literalExpression "pkgs.vim";
};
defaultEditor = mkOption {
type = types.bool;
default = false;
description = ''
Whether to configure <command>vim</command> as the default
editor using the <envar>EDITOR</envar> environment variable.
'';
}; };
}; };
}; };
@ -170,6 +180,8 @@ in {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "vim"; };
programs.vim = { programs.vim = {
package = vim; package = vim;
plugins = defaultPlugins; plugins = defaultPlugins;