Files
notfiles/home/modules/helix.nix
T
2026-06-16 12:48:27 -04:00

139 lines
3.2 KiB
Nix

{ pkgs, lib, ... }:
let
macKeys = {
"Cmd-b" = "page_up";
"Cmd-f" = "page_down";
"Cmd-u" = "page_cursor_half_up";
"Cmd-d" = "page_cursor_half_down";
"Cmd-j" = "insert_newline";
"Cmd-h" = "delete_char_backward";
"Cmd-w" = "delete_word_backward";
"Cmd-x" = "completion";
"Cmd-c" = "toggle_comments";
"Cmd-i" = "jump_forward";
"Cmd-o" = "jump_backward";
"Cmd-s" = "save_selection";
"Cmd-r" = "insert_register";
"Cmd-z" = "suspend";
"Cmd-a" = "increment";
};
in
{
programs.helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "onedark";
editor = {
scrolloff = 10;
mouse = true;
middle-click-paste = true;
scroll-lines = 3;
line-number = "absolute";
cursorline = false;
cursorcolumn = false;
continue-comments = true;
auto-completion = true;
path-completion = true;
auto-format = true;
preview-completion-insert = true;
completion-trigger-len = 2;
auto-info = true;
true-color = true;
bufferline = "multiple";
rulers = [ 88 ];
color-modes = false;
text-width = 88;
default-line-ending = "lf";
insert-final-newline = true;
auto-pairs = false;
lsp = {
enable = true;
display-messages = true;
auto-signature-help = true;
display-inlay-hints = true;
display-signature-help-docs = true;
snippets = true;
goto-reference-include-declaration = true;
};
cursor-shape = {
normal = "block";
insert = "bar";
select = "block";
};
file-picker = {
hidden = false;
follow-symlinks = true;
ignore = true;
git-ignore = false;
};
auto-save = {
focus-lost = false;
after-delay.enable = false;
};
search = {
smart-case = true;
wrap-around = true;
};
whitespace.render = {
space = "none";
tab = "all";
nbsp = "none";
nnbsp = "none";
newline = "none";
};
whitespace.characters = {
tab = "→";
};
indent-guides = {
render = true;
character = "⎪";
skip-levels = 1;
};
soft-wrap = {
enable = true;
max-wrap = 25;
};
inline-diagnostics = {
cursor-line = "info";
};
};
keys.normal = {
"C-g" = [ ":new" ":insert-output lazygit" ":buffer-close!" ":redraw" ];
"d" = "delete_selection_noyank";
"A-d" = "delete_selection";
"C-y" = [
":sh rm -f /tmp/yazi-chooser"
'':insert-output yazi "%{buffer_name}" --chooser-file=/tmp/yazi-chooser''
'':sh printf '\x1b[?1049h\x1b[?2004h' > /dev/tty''
'':open %sh{cat /tmp/yazi-chooser}''
":redraw"
];
} // lib.optionalAttrs pkgs.stdenv.isDarwin macKeys;
keys.select = {
} // lib.optionalAttrs pkgs.stdenv.isDarwin macKeys;
};
extraPackages = with pkgs; [
marksman
nil
];
};
}