2024-07-27 06:49:29 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.vim;
|
2024-07-27 06:49:29 +00:00
|
|
|
in
|
|
|
|
{
|
2020-04-24 23:36:52 +00:00
|
|
|
options.programs.vim = {
|
2024-07-27 06:49:29 +00:00
|
|
|
enable = lib.mkEnableOption "Vi IMproved, an advanced text";
|
2020-10-16 20:44:37 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
defaultEditor = lib.mkEnableOption "vim as the default editor";
|
|
|
|
|
|
|
|
package = lib.mkPackageOption pkgs "vim" { example = "vim-full"; };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# TODO: convert it into assert after 24.11 release
|
|
|
|
config = lib.mkIf (cfg.enable || cfg.defaultEditor) {
|
|
|
|
warnings = lib.mkIf (cfg.defaultEditor && !cfg.enable) [
|
|
|
|
"programs.vim.defaultEditor will only work if programs.vim.enable is enabled, which will be enforced after the 24.11 release"
|
|
|
|
];
|
|
|
|
environment = {
|
|
|
|
systemPackages = [ cfg.package ];
|
|
|
|
variables.EDITOR = lib.mkIf cfg.defaultEditor (lib.mkOverride 900 "vim");
|
|
|
|
pathsToLink = [ "/share/vim-plugins" ];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|