nix-configs/modules/shell/helix.nix
2024-08-26 13:42:20 +02:00

183 lines
4.7 KiB
Nix

{
config,
helix-inline-diags,
...
}: {
home-manager.users.jade = {
pkgs,
pkgs-stable,
...
}: {
home = {
sessionVariables.EDITOR = "hx";
packages = [
pkgs.nil
pkgs.vscode-langservers-extracted
pkgs.nodePackages.typescript-language-server
pkgs.emmet-language-server
pkgs-stable.typst-lsp
];
};
programs.helix = {
enable = true;
package = helix-inline-diags.outputs.packages."x86_64-linux".default;
settings = {
theme = "gruvbox";
editor = {
line-number = "relative";
bufferline = "multiple";
color-modes = true;
cursorline = true;
auto-save = true;
auto-format = true;
end-of-line-diagnostics = "hint";
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
lsp = {
display-messages = true;
display-inlay-hints = true;
};
popup-border = "popup";
shell = ["nu" "-c"];
statusline.left = [
"mode"
"spinner"
"spacer"
"version-control"
"file-name"
"diagnostics"
"read-only-indicator"
"file-modification-indicator"
"spacer"
];
statusline.right = [
"workspace-diagnostics"
"register"
"position"
"selections"
"file-encoding"
"file-type"
];
idle-timeout = 50;
indent-guides = {
render = true;
character = "";
};
whitespace = {
render = {
space = "all";
tab = "all";
newline = "none";
};
characters = {
space = "·";
nbsp = "";
tab = "";
};
};
};
keys = {
normal = {
space."=" = ":fmt";
};
insert = {
up = "no_op";
down = "no_op";
left = "no_op";
right = "no_op";
pageup = "no_op";
pagedown = "no_op";
home = "no_op";
end = "no_op";
};
};
};
languages = {
language-server = {
"nu-builtin-lsp" = {
command = "${config.users.defaultUserShell}/bin/nu";
args = ["--lsp"];
};
"rust-analyzer" = {
config = {
check.command = "check";
completion.snippets.custom = {
"pub fn" = {
prefix = ["pfn" "pubfn"];
postfix = ["pfn"];
body = [
"pub fn $\{receiver\}() {"
"\\t$1"
"}"
];
scope = "type";
};
};
completion.termSearch.enable = true;
diagnostics.enable = true;
inlayHints = {
bindingModeHints.enable = true;
closureCaptureHints.enable = true;
closureReturnTypeHints.enable = true;
discriminantHints.enable = true;
expressionAdjustmentHints = {
hideOutsideUnsafe = true;
};
lifetimeElisionHints.enable = "skip_trivial";
};
interpret.tests = true;
lens = {
references = {
adt.enable = true;
trait.enable = true;
};
};
typing.autoClosingAngleBrackets.enable = true;
};
};
"emmet-language-server" = {
command = "emmet-language-server";
args = ["--stdio"];
};
"psalm" = {
command = "psalm";
args = ["--language-server"];
};
"typst-lsp" = {
config = {
exportPdf = "onType";
};
};
};
language = [
{
name = "nu";
language-servers = ["nu-builtin-lsp"];
}
{
name = "php";
language-servers = ["psalm"];
}
{
name = "nix";
formatter = {
command = "${pkgs.alejandra}/bin/alejandra";
args = ["--quiet"];
};
auto-format = true;
}
{
name = "html";
roots = [".git"];
language-servers = ["vscode-html-language-server" "emmet-language-server"];
auto-format = false;
}
];
};
};
};
}