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.";
};
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 {
type = types.lines;
default = "";
@ -372,6 +381,8 @@ in {
home.packages = [ cfg.finalPackage ];
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; };
xdg.configFile =
let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs;
in mkMerge (

View file

@ -127,9 +127,19 @@ in {
packageConfigurable = mkOption {
type = types.package;
description = "Configurable vim package";
default = pkgs.vim_configurable;
defaultText = "pkgs.vim_configurable";
description = "Vim package to customize";
default = pkgs.vim-full or 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.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "vim"; };
programs.vim = {
package = vim;
plugins = defaultPlugins;