nichts/modules/programs/editors/helix/module.nix

94 lines
2.5 KiB
Nix

{
config,
inputs,
lib,
pkgs,
...
}: let
cfg = config.modules.system.programs.editors.helix;
inherit (config.modules.other.system) username;
inherit (lib) mkIf getExe;
inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix;
wrapped-helix = pkgs.symlinkJoin {
name = "helix-wrapped";
paths = with pkgs; [
helix
# C/C++
clang-tools
# Markdown
marksman
# Nix
nil
lldb_19
# Bash
bash-language-server
# Shell
shellcheck
];
};
in {
imports = [./languages.nix];
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.helix = {
enable = true;
package = wrapped-helix;
settings = {
theme = "catppuccin_mocha";
editor = {
cursorline = false;
color-modes = true;
indent-guides.render = true;
lsp = {
display-inlay-hints = true;
display-messages = true;
};
line-number = "relative";
true-color = true;
auto-format = true;
completion-timeout = 5;
mouse = true;
bufferline = "multiple";
soft-wrap.enable = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
statusline = {
left = ["spinner" "version-control" "diagnostics" "file-name"];
right = ["file-base-name" "file-type" "position" "file-encoding"];
};
gutters.layout = ["diff" "diagnostics" "line-numbers" "spacer"];
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
};
keys = {
normal = {
space.g = [":new" ":insert-output ${getExe pkgs.lazygit}" ":buffer-close!" ":redraw"];
esc = ["collapse_selection" "keep_primary_selection" "normal_mode"];
A-H = "goto_previous_buffer";
A-L = "goto_next_buffer";
A-w = ":buffer-close";
A-f = ":format";
A-r = ":reload";
A-x = "extend_to_line_bounds";
X = ["extend_line_up" "extend_to_line_bounds"];
};
select = {
A-x = "extend_to_line_bounds";
X = ["extend_line_up" "extend_to_line_bounds"];
};
};
};
};
};
};
}