about summary refs log tree commit diff
path: root/modules/vim/default.nix
blob: 94cc7afa838744bd16d91bd7d221d753dd45fb15 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
  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 {
    hm.stylix.targets.vim.enable = false;

    programs.vim.package =
      (pkgs.vim-full.override {
        cscopeSupport = false;
        darwinSupport = false;
        features = "normal";
        guiSupport = "gtk3";
        luaSupport = false;
        multibyteSupport = false;
        netbeansSupport = false;
        nlsSupport = false;
        perlSupport = false;
        pythonSupport = false;
        rubySupport = false;
        tclSupport = false;
        ximSupport = false;
      }).customize
        {
          name = "vim";
          vimrcConfig = with cfg; {
            customRC = rc;
            packages.myVimPackage.start = plugins;
          };
        };

    environment = {
      systemPackages = [ config.programs.vim.package ];
      variables = rec {
        EDITOR = "vim";
        VISUAL = EDITOR;
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3