summaryrefslogtreecommitdiff
path: root/home-manager/features/cli/apps/helix.nix
blob: a267b23d88539488a546920e134905287209d951 (plain)
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,
  pkgs,
  lib,
  ...
}: let
  cfg = config.features.cli.apps.helix;
in {
  options.features.cli.apps.helix.enable = lib.mkEnableOption "helix";
  config = lib.mkIf cfg.enable {
    home.packages = with pkgs; [
      wl-clipboard
    ];
    programs.helix = {
      enable = true;
      extraPackages = with pkgs; [
        markdown-oxide
        python312Packages.black
        vscode-langservers-extracted
        nil
      ];
      settings = {
        editor = {
          color-modes = true;
          true-color = true;
          line-number = "relative";
          mouse = false;
          lsp.display-messages = true;
          statusline = {
            left = ["file-name" "file-modification-indicator"];
            center = [];
            right = [];
            mode = {
              normal = "NORMAL";
              insert = "INSERT";
              select = "SELECT";
            };
          };
          cursor-shape = {
            normal = "block";
            insert = "bar";
            select = "underline";
          };
          soft-wrap = {
            enable = true;
            wrap-indicator = "";
          };
        };
        keys = {
          normal = {
            esc = ["collapse_selection" "keep_primary_selection"];
            space = {
              v = "file_picker_in_current_buffer_directory";
              h = ":lsp-workspace-command";
            };
          };
        };
      };
      languages = {
        language = [
          {
            name = "nix";
            auto-format = true;
            formatter.command = "${pkgs.alejandra}/bin/alejandra";
            language-servers = ["nil"];
          }
        ];
      };
    };
  };
}