about summary refs log tree commit diff
path: root/modules/common/vim/default.nix
blob: 93729bc9b7f63a06090034fb49448236f20155c3 (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
{
  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;

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

Consider giving Nix/NixOS a try! <3