nix/modules/home-manager/helix.nix

526 lines
12 KiB
Nix
Raw Normal View History

2023-10-05 13:43:28 -05:00
{
2024-03-19 10:25:29 -05:00
config,
2024-02-16 16:32:14 -06:00
pkgs,
2023-10-05 13:43:28 -05:00
inputs,
colors,
...
2024-02-16 16:32:14 -06:00
}: let
inherit (pkgs) system;
in {
2024-03-19 10:25:29 -05:00
# helix rust debugger stuff
# https://github.com/helix-editor/helix/wiki/Debugger-Configurations
home.file."${config.xdg.configHome}/lldb_vscode_rustc_primer.py" = {
text = ''
import subprocess
import pathlib
import lldb
# Determine the sysroot for the active Rust interpreter
rustlib_etc = pathlib.Path(subprocess.getoutput('rustc --print sysroot')) / 'lib' / 'rustlib' / 'etc'
if not rustlib_etc.exists():
raise RuntimeError('Unable to determine rustc sysroot')
# Load lldb_lookup.py and execute lldb_commands with the correct path
lldb.debugger.HandleCommand(f"""command script import "{rustlib_etc / 'lldb_lookup.py'}" """)
lldb.debugger.HandleCommand(f"""command source -s 0 "{rustlib_etc / 'lldb_commands'}" """)
'';
};
2023-10-05 13:43:28 -05:00
programs.helix = {
enable = true;
package = inputs.helix.packages.${system}.helix;
languages = {
language-server = {
2023-10-27 21:46:38 -05:00
lexical = {
command = "lexical";
args = ["start"];
};
2023-10-26 14:58:03 -05:00
# next-ls = {
# command = "next-ls";
# args = ["--stdout"];
# };
# deno = {
# command = "deno";
# args = ["lsp"];
# config = {
# enable = true;
# lint = true;
# unstable = true;
# };
# };
2023-10-05 13:43:28 -05:00
};
language = [
# {
# name = "heex";
# scope = "source.heex";
# injection-regex = "heex";
# language-servers = ["lexical"]; # "lexical" "next-ls" ?
# auto-format = true;
# file-types = ["heex"];
# roots = ["mix.exs" "mix.lock"];
# indent = {
# tab-width = 2;
# unit = " ";
# };
# }
# {
# name = "elixir";
# language-servers = ["lexical"]; # "lexical" "next-ls" ?
# auto-format = true;
# }
2024-03-19 10:25:29 -05:00
{
name = "rust";
debugger = {
name = "lldb-vscode";
transport = "stdio";
command = "lldb-vscode";
templates = [
{
name = "binary";
request = "launch";
completion = [
{
name = "binary";
completion = "filename";
}
];
args = {
program = "{0}";
initCommands = ["command script import ${config.xdg.configHome}/lldb_vscode_rustc_primer.py"];
};
}
];
};
}
2023-10-27 21:46:38 -05:00
{
name = "html";
2024-02-20 10:50:47 -06:00
file-types = ["html"];
scope = "source.html";
2023-10-27 21:46:38 -05:00
auto-format = false;
}
{
name = "nix";
2024-02-20 10:50:47 -06:00
file-types = ["nix"];
scope = "source.nix";
2023-10-27 21:46:38 -05:00
auto-format = true;
formatter = {
command = "alejandra";
args = ["-"];
};
}
{
name = "fish";
2024-02-20 10:50:47 -06:00
file-types = ["fish"];
scope = "source.fish";
2023-10-27 21:46:38 -05:00
auto-format = true;
indent = {
tab-width = 2;
unit = "\t";
};
}
2023-10-26 14:58:03 -05:00
# {
# name = "javascript";
# language-id = "javascript";
# grammar = "javascript";
# scope = "source.js";
# injection-regex = "^(js|javascript)$";
# file-types = ["js" "mjs"];
# shebangs = ["deno"];
# language-servers = ["deno"];
# roots = ["deno.jsonc" "deno.json"];
# formatter = {
# command = "deno";
# args = ["fmt"];
# };
# auto-format = true;
# comment-token = "//";
# indent = {
# tab-width = 2;
# unit = "\t";
# };
# }
# {
# name = "typescript";
# language-id = "typescript";
# grammar = "typescript";
# scope = "source.ts";
# injection-regex = "^(ts|typescript)$";
# file-types = ["ts"];
# shebangs = ["deno"];
# language-servers = ["deno"];
# roots = ["deno.jsonc" "deno.json"];
# formatter = {
# command = "deno";
# args = ["fmt"];
# };
# auto-format = true;
# comment-token = "//";
# indent = {
# tab-width = 2;
# unit = "\t";
# };
# }
# {
# name = "jsonc";
# language-id = "json";
# grammar = "jsonc";
# scope = "source.jsonc";
# injection-regex = "^(jsonc)$";
# roots = ["deno.jsonc" "deno.json"];
# file-types = ["jsonc"];
# language-servers = ["deno"];
# indent = {
# tab-width = 2;
# unit = " ";
# };
# auto-format = true;
# }
2023-10-05 13:43:28 -05:00
];
};
settings = {
theme = "custom";
editor = {
soft-wrap.enable = true;
2023-11-09 15:41:27 -06:00
auto-pairs = false;
2023-10-26 14:58:03 -05:00
# auto-save = false;
# completion-trigger-len = 1;
# color-modes = false;
2023-10-05 13:43:28 -05:00
bufferline = "multiple";
2023-10-26 14:58:03 -05:00
# scrolloff = 8;
2023-11-07 21:30:26 -06:00
rulers = [81 121];
2023-10-05 13:43:28 -05:00
cursorline = true;
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
2023-10-31 13:01:34 -05:00
file-picker.hidden = false;
2023-10-05 13:43:28 -05:00
indent-guides = {
render = true;
character = "";
};
2023-10-27 21:46:38 -05:00
lsp = {
display-messages = true;
# display-inlay-hints = true;
};
2023-12-17 09:58:06 -06:00
statusline = {
separator = " ";
mode = {
"normal" = "N";
"insert" = "I";
"select" = "S";
};
left = [
"file-name"
"mode"
# "selections"
# "primary-selection-length"
# "position"
# "position-percentage"
"spinner"
"diagnostics"
"workspace-diagnostics"
];
};
2023-10-26 14:58:03 -05:00
# center = ["file-name"];
2023-12-17 09:58:06 -06:00
# right = ["version-control" "total-line-numbers" "file-encoding"];
2023-10-26 14:58:03 -05:00
# };
2023-10-05 13:43:28 -05:00
};
keys = {
insert = {
j = {
k = "normal_mode";
j = "normal_mode";
K = "normal_mode";
J = "normal_mode";
};
};
normal = {
"C-k" = "jump_view_up";
"C-j" = "jump_view_down";
"C-h" = "jump_view_left";
"C-l" = "jump_view_right";
"C-q" = ":quit-all!";
2023-10-26 14:58:03 -05:00
# "L" = "repeat_last_motion";
2023-10-05 13:43:28 -05:00
space = {
q = ":reflow 80";
Q = ":reflow 120";
C = ":bc!";
h = ":toggle lsp.display-inlay-hints";
# O = ["select_textobject_inner WORD", ":pipe-to xargs xdg-open"];
};
};
select = {
space = {
q = ":reflow 80";
Q = ":reflow 120";
};
2023-10-26 14:58:03 -05:00
# "L" = "repeat_last_motion";
2023-10-05 13:43:28 -05:00
};
};
};
themes = with colors.withHashPrefix; {
custom = {
"type" = orange;
"constructor" = blue;
"constant" = orange;
"constant.builtin" = orange;
"constant.character" = yellow;
"constant.character.escape" = orange;
"string" = green;
"string.regexp" = orange;
"string.special" = blue;
"comment" = {
fg = fgdim;
modifiers = ["italic"];
};
"variable" = text;
"variable.parameter" = {
fg = red;
modifiers = ["italic"];
};
"variable.builtin" = red;
"variable.other.member" = text;
"label" = blue;
"punctuation" = fgdim;
"punctuation.special" = blue;
"keyword" = purple;
"keyword.storage.modifier.ref" = yellow;
"keyword.control.conditional" = {
fg = purple;
modifiers = ["italic"];
};
"operator" = blue;
"function" = blue;
"function.macro" = purple;
"tag" = purple;
"attribute" = blue;
"namespace" = {
fg = blue;
modifiers = ["italic"];
};
"special" = blue;
"markup.heading.marker" = {
fg = orange;
modifiers = ["bold"];
};
"markup.heading.1" = blue;
"markup.heading.2" = yellow;
"markup.heading.3" = green;
"markup.heading.4" = orange;
"markup.heading.5" = red;
"markup.heading.6" = fg3;
"markup.list" = purple;
"markup.bold" = {modifiers = ["bold"];};
"markup.italic" = {modifiers = ["italic"];};
"markup.strikethrough" = {modifiers = ["crossed_out"];};
"markup.link.url" = {
fg = red;
modifiers = ["underlined"];
};
"markup.link.text" = blue;
"markup.raw" = red;
"diff.plus" = green;
"diff.minus" = red;
"diff.delta" = blue;
"ui.linenr" = {fg = fgdim;};
"ui.linenr.selected" = {fg = fg2;};
"ui.statusline" = {
fg = fgdim;
2023-12-17 09:58:06 -06:00
bg = bg;
2023-10-05 13:43:28 -05:00
};
"ui.statusline.inactive" = {
fg = fg3;
2023-12-17 09:58:06 -06:00
bg = bg2;
2023-10-05 13:43:28 -05:00
};
"ui.statusline.normal" = {
fg = bg;
bg = purple;
modifiers = ["bold"];
};
"ui.statusline.insert" = {
fg = bg;
bg = green;
modifiers = ["bold"];
};
"ui.statusline.select" = {
fg = bg;
bg = red;
modifiers = ["bold"];
};
"ui.popup" = {
fg = text;
bg = bg2;
};
"ui.window" = {fg = fgdim;};
"ui.help" = {
fg = fg2;
bg = bg2;
};
"ui.bufferline" = {
fg = fgdim;
bg = bg2;
};
"ui.bufferline.background" = {bg = bg2;};
"ui.text" = text;
"ui.text.focus" = {
fg = text;
bg = bg3;
modifiers = ["bold"];
};
"ui.text.inactive" = {fg = fg2;};
"ui.virtual" = fg2;
"ui.virtual.ruler" = {bg = bg3;};
"ui.virtual.indent-guide" = bg3;
"ui.virtual.inlay-hint" = {
fg = bg3;
bg = bg;
};
"ui.selection" = {bg = bg5;};
"ui.cursor" = {
fg = bg;
bg = text;
};
"ui.cursor.primary" = {
fg = bg;
bg = red;
};
"ui.cursor.match" = {
fg = orange;
modifiers = ["bold"];
};
"ui.cursor.primary.normal" = {
fg = bg;
bg = text;
};
"ui.cursor.primary.insert" = {
fg = bg;
bg = text;
};
"ui.cursor.primary.select" = {
fg = bg;
bg = text;
};
"ui.cursor.normal" = {
fg = bg;
bg = fg;
};
"ui.cursor.insert" = {
fg = bg;
bg = fg;
};
"ui.cursor.select" = {
fg = bg;
bg = fg;
};
"ui.cursorline.primary" = {bg = bg3;};
"ui.highlight" = {
bg = bg3;
2023-10-05 13:43:28 -05:00
fg = bg;
modifiers = ["bold"];
};
"ui.menu" = {
fg = fg3;
bg = bg2;
};
"ui.menu.selected" = {
fg = text;
bg = bg3;
modifiers = ["bold"];
};
"diagnostic.error" = {
underline = {
color = red;
style = "curl";
};
};
"diagnostic.warning" = {
underline = {
color = orange;
style = "curl";
};
};
"diagnostic.info" = {
underline = {
color = blue;
style = "curl";
};
};
"diagnostic.hint" = {
underline = {
color = blue;
style = "curl";
};
};
error = red;
warning = orange;
info = blue;
hint = yellow;
"ui.background" = {
bg = bg;
fg = fgdim;
};
# "ui.cursorline.primary" = { bg = "default" }
# "ui.cursorline.secondary" = { bg = "default" }
"ui.cursorcolumn.primary" = {bg = bg3;};
"ui.cursorcolumn.secondary" = {bg = bg3;};
"ui.bufferline.active" = {
fg = primary;
bg = bg3;
underline = {
color = primary;
style = "";
};
};
};
};
};
}