about summary refs log tree commit diff
path: root/modules/common/vim/default.nix
blob: cd24768db7c6236b5ba26cc1394af421a8fe95d7 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  config,
  lib,
  pkgs,
  ...
}:
with lib; let
  cfg = config.nixfiles.modules.vim;
in {
  options.nixfiles.modules.vim = {
    enable = mkEnableOption "Vim";

    rc = mkOption {
      type = types.str;
      default = readFile ./rc.vim;
      description = "Configuration file.";
    };

    plugins = mkOption {
      type = with types; listOf package;
      default = with pkgs.vimPlugins; [
        editorconfig-vim
        vim-eunuch
        vim-nix
        vim-sensible
        vim-sleuth
        vim-surround
        vim-unimpaired
      ];
      description = "Plugins.";
    };
  };

  config = mkIf cfg.enable {
    environment = with config.programs.vim; {
      systemPackages = [package];
      variables = rec {
        EDITOR = mkOverride 15 (getExe' package "vim");
        VISUAL = EDITOR;
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3