368 lines
11 KiB
Nix
368 lines
11 KiB
Nix
{lib, config, ...}:
|
|
let
|
|
cfg = config.helixApp;
|
|
in
|
|
{
|
|
options.helixApp = {
|
|
enable = lib.mkEnableOption "enable helix editor";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# Let Stylix auto-theme helix
|
|
stylix.targets.helix.enable = true;
|
|
|
|
programs.helix = {
|
|
enable = true;
|
|
|
|
# Stylix sets the theme, but we override syntax tokens for minimal highlighting
|
|
# Philosophy: Only keywords, strings, comments, numbers get color - rest is plain text
|
|
themes.stylix = {
|
|
# Inherit Stylix's base theme (UI, palette, etc.)
|
|
inherits = "stylix";
|
|
|
|
# Minimal syntax highlighting - only 4 categories get color
|
|
# Comments - stand out
|
|
"comment" = { fg = "yellow"; modifiers = ["italic"]; };
|
|
|
|
# Keywords - highlighted and italic
|
|
"keyword" = { fg = "magenta"; modifiers = ["italic"]; };
|
|
"keyword.control" = { fg = "magenta"; modifiers = ["italic"]; };
|
|
"keyword.directive" = { fg = "magenta"; modifiers = ["italic"]; };
|
|
"keyword.function" = { fg = "magenta"; modifiers = ["italic"]; };
|
|
"keyword.operator" = { fg = "magenta"; modifiers = ["italic"]; };
|
|
"keyword.return" = { fg = "magenta"; modifiers = ["italic"]; };
|
|
"keyword.storage" = { fg = "magenta"; modifiers = ["italic"]; };
|
|
|
|
# Strings - highlighted
|
|
"string" = "green";
|
|
"string.regexp" = "red";
|
|
"string.special" = "green";
|
|
|
|
# Numbers/constants - highlighted
|
|
"constant.numeric" = "red";
|
|
"constant.builtin" = "red";
|
|
"constant.character.escape" = "red";
|
|
|
|
# Functions remain plain text
|
|
"function" = "text";
|
|
"function.builtin" = "text";
|
|
"function.method" = "text";
|
|
"function.macro" = "text";
|
|
|
|
# Variables remain plain text
|
|
"variable" = "text";
|
|
"variable.builtin" = "text";
|
|
"variable.parameter" = "text";
|
|
"variable.other.member" = "text";
|
|
|
|
# Types get subtle highlight
|
|
"type" = { fg = "cyan"; modifiers = ["italic"]; };
|
|
"type.builtin" = "cyan";
|
|
|
|
# Top-level definitions get accent
|
|
"function.definition" = { fg = "text"; modifiers = ["bold"]; };
|
|
"type.definition" = { fg = "text"; modifiers = ["bold"]; };
|
|
|
|
# Everything else plain
|
|
"constructor" = "text";
|
|
"attribute" = "text";
|
|
"label" = "text";
|
|
"namespace" = "text";
|
|
"tag" = "text";
|
|
|
|
# Punctuation slightly dimmed
|
|
"punctuation" = { fg = "text"; modifiers = ["dim"]; };
|
|
"punctuation.bracket" = { fg = "text"; modifiers = ["dim"]; };
|
|
"punctuation.delimiter" = { fg = "text"; modifiers = ["dim"]; };
|
|
"punctuation.special" = { fg = "text"; modifiers = ["dim"]; };
|
|
"operator" = { fg = "text"; modifiers = ["dim"]; };
|
|
|
|
# Markup
|
|
"markup.heading" = { fg = "cyan"; modifiers = ["bold"]; };
|
|
"markup.list" = "magenta";
|
|
"markup.bold" = { modifiers = ["bold"]; };
|
|
"markup.italic" = { modifiers = ["italic"]; };
|
|
"markup.strikethrough" = { modifiers = ["crossed_out"]; };
|
|
"markup.link.url" = { fg = "blue"; modifiers = ["underlined"]; };
|
|
"markup.link.text" = "magenta";
|
|
"markup.quote" = "green";
|
|
"markup.raw" = "green";
|
|
};
|
|
|
|
settings = {
|
|
keys.normal = {
|
|
# Navigation (Colemak-DH)
|
|
n = "move_char_left";
|
|
i = "move_visual_line_down";
|
|
e = "move_visual_line_up";
|
|
o = "move_char_right";
|
|
"S-tab" = "jump_backward";
|
|
I = [ "page_cursor_half_down" "align_view_center" ];
|
|
E = [ "page_cursor_half_up" "align_view_center" ];
|
|
|
|
# Modes
|
|
h = "insert_mode";
|
|
H = "insert_at_line_start";
|
|
l = "open_below";
|
|
L = "open_above";
|
|
|
|
# Search
|
|
k = "search_next";
|
|
K = "search_prev";
|
|
|
|
# Selection
|
|
C-s = "split_selection_on_newline";
|
|
C-minus = "merge_selections";
|
|
C-_ = "merge_consecutive_selections";
|
|
"C-;" = "flip_selections";
|
|
"C-:" = "ensure_selections_forward";
|
|
"C-," = "remove_primary_selection";
|
|
C-c = "change_selection_noyank";
|
|
C-d = "delete_selection_noyank";
|
|
"C-(" = "rotate_selection_contents_backward";
|
|
"C-)" = "rotate_selection_contents_forward";
|
|
C-x = "shrink_to_line_bounds";
|
|
C-J = "join_selections_space";
|
|
C-K = "remove_selections";
|
|
C-o = "expand_selection";
|
|
C-i = "shrink_selection";
|
|
C-p = "select_prev_sibling";
|
|
C-n = "select_next_sibling";
|
|
|
|
# Misc
|
|
"C-/" = "toggle_comments";
|
|
"@" = ":append-output git config get user.email";
|
|
|
|
space = {
|
|
B = ":sh git log -n 5 --format='format:%%h (%%an: %%ar) %%s' --no-patch -L%{cursor_line},+1:%{buffer_name}";
|
|
x = ":write-buffer-close";
|
|
X = ":write-quit-all";
|
|
o = ":config-open";
|
|
h = "hover";
|
|
k = "select_references_to_symbol_under_cursor";
|
|
};
|
|
|
|
g = {
|
|
"/" = "goto_next_buffer";
|
|
h = "goto_previous_buffer";
|
|
n = [ "collapse_selection" "extend_to_line_start" ];
|
|
o = [ "collapse_selection" "extend_to_line_end" ];
|
|
e = "move_line_up";
|
|
i = "move_line_down";
|
|
l = "goto_last_line";
|
|
p = "no_op";
|
|
k = "no_op";
|
|
j = "no_op";
|
|
};
|
|
|
|
m.m = [ "select_mode" "match_brackets" "normal_mode" ];
|
|
|
|
"C-w" = {
|
|
h = "hsplit";
|
|
C-h = "hsplit";
|
|
n = "jump_view_left";
|
|
C-n = "jump_view_left";
|
|
i = "jump_view_down";
|
|
I = "swap_view_down";
|
|
C-i = "jump_view_down";
|
|
e = "jump_view_up";
|
|
E = "swap_view_up";
|
|
C-e = "jump_view_up";
|
|
o = "jump_view_right";
|
|
O = "swap_view_right";
|
|
C-o = "jump_view_right";
|
|
# Remove old
|
|
s = "no_op";
|
|
C-s = "no_op";
|
|
H = "no_op";
|
|
j = "no_op";
|
|
J = "no_op";
|
|
C-j = "no_op";
|
|
k = "no_op";
|
|
K = "no_op";
|
|
C-k = "no_op";
|
|
l = "no_op";
|
|
L = "no_op";
|
|
C-l = "no_op";
|
|
};
|
|
};
|
|
|
|
keys.select = {
|
|
n = "extend_char_left";
|
|
i = "extend_line_down";
|
|
e = "extend_line_up";
|
|
o = "extend_char_right";
|
|
I = [ "page_cursor_half_down" "align_view_center" ];
|
|
E = [ "page_cursor_half_up" "align_view_center" ];
|
|
|
|
g = {
|
|
"/" = "goto_next_buffer";
|
|
h = "goto_previous_buffer";
|
|
n = "goto_line_start";
|
|
o = "goto_line_end";
|
|
e = "move_line_up";
|
|
i = "move_line_down";
|
|
l = "goto_last_line";
|
|
p = "no_op";
|
|
k = "no_op";
|
|
j = "no_op";
|
|
};
|
|
};
|
|
|
|
editor = {
|
|
auto-format = true;
|
|
auto-save = true;
|
|
bufferline = "always";
|
|
color-modes = true;
|
|
completion-timeout = 5;
|
|
cursorcolumn = true;
|
|
cursorline = true;
|
|
indent-heuristic = "tree-sitter";
|
|
line-number = "relative";
|
|
rulers = [ 120 ];
|
|
text-width = 120;
|
|
end-of-line-diagnostics = "hint";
|
|
|
|
cursor-shape = {
|
|
insert = "bar";
|
|
normal = "block";
|
|
select = "underline";
|
|
};
|
|
|
|
file-picker.hidden = false;
|
|
|
|
indent-guides.render = true;
|
|
|
|
inline-diagnostics = {
|
|
cursor-line = "warning";
|
|
other-lines = "disable";
|
|
prefix-len = 5;
|
|
max-diagnostics = 1;
|
|
max-wrap = 30;
|
|
};
|
|
|
|
lsp = {
|
|
display-messages = true;
|
|
display-inlay-hints = true;
|
|
};
|
|
|
|
soft-wrap = {
|
|
enable = true;
|
|
max-wrap = 30;
|
|
};
|
|
|
|
statusline = {
|
|
left = [ "mode" "file-modification-indicator" "spinner" "version-control" ];
|
|
center = [ "file-name" ];
|
|
right = [ "diagnostics" "selections" "register" "position" "file-encoding" ];
|
|
mode.normal = "Normal";
|
|
mode.insert = "Insert";
|
|
mode.select = "Select";
|
|
};
|
|
|
|
whitespace.render = {
|
|
space = "all";
|
|
tab = "all";
|
|
tabpad = "all";
|
|
newline = "none";
|
|
nbsp = "none";
|
|
};
|
|
|
|
whitespace.characters = {
|
|
space = " ";
|
|
tab = "⇀";
|
|
tabpad = " ";
|
|
};
|
|
};
|
|
};
|
|
|
|
languages = {
|
|
language = [
|
|
{
|
|
name = "go";
|
|
debugger = {
|
|
name = "go";
|
|
transport = "tcp";
|
|
command = "dlv";
|
|
args = [ "connect" ];
|
|
port-arg = "127.0.0.1:2345";
|
|
templates = [{
|
|
name = "connect";
|
|
request = "launch";
|
|
completion = [];
|
|
args = {};
|
|
}];
|
|
};
|
|
}
|
|
{
|
|
name = "markdown";
|
|
language-servers = [ "marksman" ];
|
|
}
|
|
{
|
|
name = "dart";
|
|
formatter = { command = "dart"; args = [ "format" "-l" "120" ]; };
|
|
language-servers = [ "dart" ];
|
|
}
|
|
{
|
|
name = "nix";
|
|
language-servers = [ "nil" ];
|
|
}
|
|
{
|
|
name = "zig";
|
|
language-servers = [ "zls" ];
|
|
debugger = {
|
|
name = "codelldb-dap";
|
|
transport = "tcp";
|
|
command = "codelldb";
|
|
args = [];
|
|
port-arg = "--port {}";
|
|
templates = [
|
|
{
|
|
name = "launch";
|
|
request = "launch";
|
|
completion = [{ name = "binary"; completion = "filename"; }];
|
|
args = { console = "internalConsole"; program = "{0}"; };
|
|
}
|
|
{
|
|
name = "attach";
|
|
request = "attach";
|
|
completion = [ "pid" ];
|
|
args = { console = "internalConsole"; pid = "{0}"; };
|
|
}
|
|
{
|
|
name = "gdbserver attach";
|
|
request = "attach";
|
|
completion = [
|
|
{ name = "lldb connect url"; default = "connect://localhost:3333"; }
|
|
{ name = "file"; completion = "filename"; }
|
|
"pid"
|
|
];
|
|
args = {
|
|
console = "internalConsole";
|
|
attachCommands = [
|
|
"platform select remote-gdb-server"
|
|
"platform connect {0}"
|
|
"file {1}"
|
|
"attach {2}"
|
|
];
|
|
};
|
|
}
|
|
];
|
|
};
|
|
}
|
|
{
|
|
name = "cyano";
|
|
scope = "source.cyo";
|
|
file-types = [ "cyo" ];
|
|
language-servers = [ "ltex-ls" ];
|
|
}
|
|
];
|
|
|
|
language-server.ltex-ls = {
|
|
command = "ltex-ls";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|