2016-10-10 20:49:43 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.vim;
|
|
|
|
in {
|
|
|
|
options.programs.vim = {
|
|
|
|
defaultEditor = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-13 12:54:15 +00:00
|
|
|
description = ''
|
2016-10-10 20:49:43 +00:00
|
|
|
When enabled, installs vim and configures vim to be the default editor
|
|
|
|
using the EDITOR environment variable.
|
|
|
|
'';
|
|
|
|
};
|
2020-10-15 08:55:16 +00:00
|
|
|
|
2023-11-27 00:19:27 +00:00
|
|
|
package = mkPackageOption pkgs "vim" {
|
|
|
|
example = "vim-full";
|
2020-10-15 08:55:16 +00:00
|
|
|
};
|
2016-10-10 20:49:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.defaultEditor {
|
2020-10-15 08:55:16 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
environment.variables = { EDITOR = mkOverride 900 "vim"; };
|
2016-10-10 20:49:43 +00:00
|
|
|
};
|
|
|
|
}
|