NOflake/users/tao/helix.nix

304 lines
10 KiB
Nix
Raw Normal View History

2025-10-16 16:44:43 -07:00
{
inputs,
pkgs,
...
}: {
2025-04-30 19:29:00 -07:00
programs.helix = {
settings = {
2025-11-05 00:58:59 -08:00
# keep-sorted start block=yes
2025-04-30 19:29:00 -07:00
editor = {
2025-11-05 00:58:59 -08:00
# keep-sorted start block=yes
2025-04-30 19:29:00 -07:00
auto-save = {
after-delay.enable = true;
after-delay.timeout = 1000;
2025-11-05 00:58:59 -08:00
focus-lost = true;
2025-04-30 19:29:00 -07:00
};
completion-replace = false;
cursor-shape = {
insert = "bar";
select = "underline";
};
2025-11-05 00:58:59 -08:00
cursorline = true;
end-of-line-diagnostics = "hint";
indent-guides = {
render = true;
skip-levels = 2;
2025-04-30 19:29:00 -07:00
};
2025-11-05 00:58:59 -08:00
inline-diagnostics = {
cursor-line = "warning";
};
line-number = "relative";
2025-04-30 19:29:00 -07:00
lsp = {
display-inlay-hints = true;
2025-11-05 00:58:59 -08:00
display-messages = true;
2025-04-30 19:29:00 -07:00
display-progress-messages = true;
};
2025-11-05 00:58:59 -08:00
preview-completion-insert = false;
rainbow-brackets = true;
shell = ["nu" "--stdin" "-c"];
2025-04-30 19:29:00 -07:00
smart-tab.supersede-menu = false;
2025-11-05 00:58:59 -08:00
soft-wrap.enable = true;
statusline = {
left = ["mode" "spinner" "spacer" "version-control"];
center = ["file-name" "file-modification-indicator"];
right = ["diagnostics" "primary-selection-length" "total-line-numbers" "selections" "position"];
};
# keep-sorted end
2025-04-30 19:29:00 -07:00
};
2025-11-05 00:58:59 -08:00
keys = {
# keep-sorted start block=yes
insert = {
C-space = "completion";
k = {k = "normal_mode";};
};
normal = {
j = "move_line_up";
2025-11-30 18:48:32 -08:00
k = "move_line_down";
2025-11-05 00:58:59 -08:00
};
normal.space = {
2025-12-02 17:33:57 -08:00
l = "@:reload-all<ret>";
2025-11-05 00:58:59 -08:00
w = {
J = "swap_view_up";
2025-11-30 18:48:32 -08:00
K = "swap_view_down";
j = "jump_view_up";
k = "jump_view_down";
2025-11-05 00:58:59 -08:00
};
t = {
r = "@mip:reflow<ret>";
2025-11-05 03:00:09 -08:00
s = "@<A-s>:sort<ret>";
2025-11-05 00:58:59 -08:00
};
2025-10-08 18:29:19 -07:00
};
2025-11-05 00:58:59 -08:00
select = {
j = "extend_line_up";
2025-11-30 18:48:32 -08:00
k = "extend_line_down";
2025-10-08 18:29:19 -07:00
};
2025-11-05 00:58:59 -08:00
# keep-sorted end
2024-02-19 22:41:58 -08:00
};
2025-11-05 00:58:59 -08:00
theme = "gruvbox_dark_hard";
# keep-sorted end
2025-01-30 17:42:24 -08:00
};
2025-04-30 19:29:00 -07:00
languages = {
2025-11-05 00:58:59 -08:00
# keep-sorted start block=yes
grammar = [
2025-04-30 19:29:00 -07:00
{
2025-11-05 00:58:59 -08:00
name = "arduino";
source = {
git = "https://github.com/tree-sitter-grammars/tree-sitter-arduino";
rev = "8518c3fa6b8562af545a496d55c9abd78f53e732";
};
2025-04-30 19:29:00 -07:00
}
2025-11-05 00:58:59 -08:00
];
language = [
# keep-sorted start block=yes
2025-04-30 19:29:00 -07:00
{
name = "arduino";
grammar = "arduino";
scope = "source.arduino";
injection-regex = "arduino";
file-types = ["ino" "cpp" "h"];
comment-token = "//";
roots = ["*.ino" "sketch.yaml"];
language-servers = ["arduino-language-server"];
indent = {
tab-width = 8;
unit = "\t";
};
auto-format = true;
formatter = {
command = "clang-format";
args = ["--style=file:/home/tao/templates/clang-format"];
};
}
{
name = "c";
auto-format = true;
formatter = {
command = "clang-format";
args = ["--style=file:/home/tao/templates/clang-format"];
};
indent = {
tab-width = 8;
unit = "\t";
};
}
{
name = "cpp";
auto-format = true;
formatter = {
command = "clang-format";
args = ["--style=file:/home/tao/templates/clang-format"];
};
indent = {
tab-width = 8;
unit = "\t";
};
file-types = [
"cc"
"hh"
"c++"
"cpp"
"hpp"
"h"
"ipp"
"tpp"
"cxx"
"hxx"
"ixx"
"txx"
"C"
"H"
"cu"
"cuh"
"cppm"
"h++"
"ii"
"inl"
{glob = ".hpp.in";}
{glob = ".h.in";}
];
}
2025-11-05 00:58:59 -08:00
{
name = "go";
formatter.command = "goimports";
}
2025-04-30 19:29:00 -07:00
{
name = "html";
auto-format = false;
indent = {
tab-width = 4;
unit = "\t";
};
}
# {
# name = "java";
# auto-format = true;
# indent = {
# tab-width = 4;
# unit = "\t";
# };
# }
{
name = "javascript";
auto-format = true;
indent = {
tab-width = 4;
unit = "\t";
};
}
{
name = "nix";
auto-format = true;
2025-06-22 21:49:42 -07:00
formatter = {
2025-11-05 00:58:59 -08:00
# command = "alejandra";
# args = ["--experimental-config" "%{workspace_directory}/alejandra.toml"];
command = "nu";
2025-12-03 18:42:21 -08:00
args = ["--stdin" "-c" "alejandra --quiet --experimental-config '/home/tao/templates/alejandra.toml' | keep-sorted -"];
2025-06-22 21:49:42 -07:00
};
2025-11-05 00:58:59 -08:00
language-servers = ["nil"];
}
{
name = "python";
auto-format = true;
language-servers = ["basedpyright" "ty" "ruff"];
# formatter = {
# command = "ruff";
# args = ["format"];
# };
}
{
name = "scheme";
language-servers = ["steel"];
}
{
name = "sql";
language-servers = ["sqls"];
2025-04-30 19:29:00 -07:00
}
{
name = "toml";
auto-format = true;
}
{
name = "typst";
language-servers = ["tinymist"];
}
{
2025-11-05 00:58:59 -08:00
name = "typst";
text-width = 100;
2025-04-30 19:29:00 -07:00
}
2025-11-05 00:58:59 -08:00
# keep-sorted end
2025-04-30 19:29:00 -07:00
];
language-server = {
2025-09-18 00:24:21 -07:00
basedpyright = {
command = "basedpyright-langserver";
args = ["--stdio"];
};
2025-04-30 19:29:00 -07:00
rust-analyzer.config.check.command = "clippy";
# gas = {
# command = "asm-lsp";
# };
# jdtls = {
# command = "jdtls";
# args = ["-data" "/home/tao/.cache/jdtls/workspace"];
# };
arduino-language-server = {
command = "boxxy";
args = ["arduino-language-server" "-cli" "arduino-cli" "-cli-config" "~/.local/share/arduino/cli/arduino-cli.yaml" "-jobs" "0"];
};
# gopls = {
# config = {
# unusedVariable = false;
# };
# };
sqls = {
command = "sqls";
};
tinymist = {
command = "tinymist";
config = {
exportPdf = "onType";
outputPath = "$root/$dir/$name";
};
};
steel-language-server = {
command = "steel-language-server";
};
};
2025-11-05 00:58:59 -08:00
language-servers = {
rust-analyzer.config = {
server.path = "/home/tao/.cargo/bin/rust-analyzer";
procMacro = {
ignored = {
leptos_macro = [
# Optional:
# "component",
"server"
];
};
2025-04-30 19:29:00 -07:00
};
2025-11-05 00:58:59 -08:00
};
};
use-grammars.only = [
# keep-sorted start
"bash"
"c"
"cpp"
"gas"
"html"
"just"
"markdown"
"nix"
"rust"
"scheme"
"sql"
"toml"
"typst"
# keep-sorted end
2025-04-30 19:29:00 -07:00
];
2025-01-30 17:42:24 -08:00
};
2025-11-05 00:58:59 -08:00
# keep-sorted end
2025-04-30 19:29:00 -07:00
enable = true;
defaultEditor = true;
2025-09-10 12:55:40 -07:00
package = inputs.helix.packages.${pkgs.system}.default;
2024-01-30 10:46:26 -08:00
};
}