about summary refs log tree commit diff
path: root/nixos/modules/programs/vim.nix
blob: 8476c1accd31e1dad3c46971aabd3e42279f0451 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.programs.vim;
in {
  options.programs.vim = {
    defaultEditor = mkOption {
      type = types.bool;
      default = false;
      example = true;
      description = ''
        When enabled, installs vim and configures vim to be the default editor
        using the EDITOR environment variable.
      '';
    };
  };

  config = mkIf cfg.defaultEditor {
        environment.systemPackages = [ pkgs.vim ];
        environment.variables = { EDITOR = mkOverride 900 "vim"; };
  };
}