blob: 8c39ec237a7c22fd9ff7d9e7e0551346e6500c09 (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
{
pkgs,
lib,
config,
...
}: let
cfg = config.collinux.terminal.programs.helix;
toml' = pkgs.formats.toml {};
languages = toml'.generate "languages.toml" {
language-server = {
rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer";
nil.command = "${pkgs.nil}/bin/nil";
superhtml = {
command = "${pkgs.superhtml}/bin/superhtml";
args = ["lsp"];
};
dhall-lsp-server.command = "${pkgs.dhall-lsp-server}/bin/dhall-lsp-server";
};
language = [
{
name = "nix";
file-types = ["nix"];
language-servers = ["nil"];
indent = {
tab-width = 2;
unit = " ";
};
formatter.command = "${pkgs.alejandra}/bin/alejandra";
auto-format = true;
}
{
name = "html";
file-types = ["html"];
language-servers = ["superhtml"];
auto-format = true;
}
];
};
customCatppuccinTheme = toml'.generate "catppuccin_mocha_transparent.toml" {
inherits = "catppuccin_mocha";
"ui.background" = {};
};
mkHelixConfig = {
theme,
hardMode ? false,
}:
toml'.generate "config.toml" {
inherit theme;
editor = {
gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"];
cursorline = true;
color-modes = true;
mouse = !hardMode;
lsp.display-inlay-hints = true;
statusline = {
left = ["mode" "file-name" "spacer" "file-modification-indicator"];
right = ["spinner" "spacer" "workspace-diagnostics" "file-type"];
separator = "x";
};
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
};
keys = {
normal =
{
"C-space" = "expand_selection";
"A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"];
"A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"];
"X" = ["extend_line_up" "extend_to_line_bounds"];
"C-left" = "goto_line_start";
"C-right" = "goto_line_end";
";" = "flip_selections";
"esc" = ["collapse_selection" "keep_primary_selection"];
# I don't even use these anyway
"pageup" = "no_op";
"pagedown" = "no_op";
"home" = "no_op";
"end" = "no_op";
}
// (
if hardMode
then {
"up" = "no_op";
"down" = "no_op";
"left" = "no_op";
"right" = "no_op";
}
else {}
);
insert =
{
"pageup" = "no_op";
"pagedown" = "no_op";
"home" = "no_op";
"end" = "no_op";
}
// (
if hardMode
then {
"up" = "no_op";
"down" = "no_op";
"left" = "no_op";
"right" = "no_op";
}
else {}
);
select = {
"esc" = ["collapse_selection" "insert_mode"];
};
};
};
settings = mkHelixConfig {
inherit (cfg) hardMode;
theme =
if cfg.theme == "catppuccin"
then "catppuccin_mocha_transparent"
else if cfg.theme == "adwaita"
then "adwaita_dark"
else "";
};
in
lib.mkIf cfg.enable {
hjem.users."${config.collinux.user.name}" = {
files = {
".config/helix/config.toml".source = settings;
".config/helix/languages.toml".source = languages;
".config/helix/themes/catppuccin_mocha_transparent.toml".source = customCatppuccinTheme;
};
packages = [
pkgs.helix
];
};
}
|