aboutsummaryrefslogtreecommitdiff
path: root/modules/terminal/system/programs/helix.nix
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2025-07-08 17:03:20 +0000
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2025-07-08 17:14:14 +0000
commit82ec91b4d2c253c6ccb783f960a2788f230d6ad1 (patch)
tree94dad925340787e5a045d9bb0d094f71dedce036 /modules/terminal/system/programs/helix.nix
parentcfe198ee85f3c5ee41f4221f49b73dd492b42fdc (diff)
start avoiding lib.enum; start using hjem generators
Diffstat (limited to 'modules/terminal/system/programs/helix.nix')
-rw-r--r--modules/terminal/system/programs/helix.nix149
1 files changed, 75 insertions, 74 deletions
diff --git a/modules/terminal/system/programs/helix.nix b/modules/terminal/system/programs/helix.nix
index 7bd9af1..358aed3 100644
--- a/modules/terminal/system/programs/helix.nix
+++ b/modules/terminal/system/programs/helix.nix
@@ -5,9 +5,8 @@
...
}: let
cfg = config.collinux.terminal.programs.helix;
- toml' = pkgs.formats.toml {};
- languages = toml'.generate "languages.toml" {
+ languages = {
language-server = {
rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer";
nil.command = "${pkgs.nil}/bin/nil";
@@ -39,7 +38,7 @@
];
};
- customCatppuccinTheme = toml'.generate "catppuccin_mocha_transparent.toml" {
+ theme = {
inherits = "catppuccin_mocha";
"ui.background" = {};
};
@@ -47,82 +46,81 @@
mkHelixConfig = {
theme,
hardMode ? false,
- }:
- toml'.generate "config.toml" {
- inherit theme;
- editor = {
- gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"];
- cursorline = true;
- color-modes = true;
+ }: {
+ inherit theme;
+ editor = {
+ gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"];
+ cursorline = true;
+ color-modes = true;
- mouse = !hardMode;
+ mouse = !hardMode;
- lsp.display-inlay-hints = true;
+ lsp.display-inlay-hints = true;
- statusline = {
- left = ["mode" "file-name" "spacer" "file-modification-indicator"];
- right = ["spinner" "spacer" "workspace-diagnostics" "file-type"];
- separator = "x";
- };
+ 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";
- };
+ 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"];
+ };
+ 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";
+ # 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";
}
- // (
- if hardMode
- then {
- "up" = "no_op";
- "down" = "no_op";
- "left" = "no_op";
- "right" = "no_op";
- }
- else {}
- );
+ else {}
+ );
- insert =
- {
- "pageup" = "no_op";
- "pagedown" = "no_op";
- "home" = "no_op";
- "end" = "no_op";
+ 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";
}
- // (
- if hardMode
- then {
- "up" = "no_op";
- "down" = "no_op";
- "left" = "no_op";
- "right" = "no_op";
- }
- else {}
- );
+ else {}
+ );
- select = {
- "esc" = ["collapse_selection" "insert_mode"];
- };
+ select = {
+ "esc" = ["collapse_selection" "insert_mode"];
};
};
+ };
settings = mkHelixConfig {
inherit (cfg) hardMode;
@@ -136,18 +134,21 @@
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;
+ files = let
+ t = value: {
+ generator = (pkgs.formats.toml {}).generate "toml_file";
+ inherit value;
+ };
+ in {
+ ".config/helix/config.toml" = t settings;
+ ".config/helix/languages.toml" = t languages;
+ ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme;
".config/fish/conf.d/helix.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable ''
set -gx EDITOR hx
'';
};
- packages = [
- pkgs.helix
- ];
+ packages = [pkgs.helix];
};
}