119 lines
3.3 KiB
Nix
119 lines
3.3 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
with lib; let
|
|
cfg = config.editor.helix;
|
|
in {
|
|
options = {
|
|
editor.helix.enable =
|
|
mkEnableOption "enable helix editor";
|
|
};
|
|
config = mkIf cfg.enable {
|
|
programs.helix = {
|
|
enable = true;
|
|
defaultEditor = true;
|
|
settings = {
|
|
editor = {
|
|
bufferline = "multiple";
|
|
cursorline = true;
|
|
inline-diagnostics.cursor-line = "warning";
|
|
line-number = "relative";
|
|
lsp = {
|
|
display-messages = true;
|
|
display-inlay-hints = true;
|
|
};
|
|
cursor-shape = {
|
|
insert = "bar";
|
|
normal = "block";
|
|
select = "underline";
|
|
};
|
|
statusline = {
|
|
left = ["mode" "spinner" "version-control"];
|
|
center = ["file-name"];
|
|
right = ["diagnostics" "selections" "position" "file-encoding" "file-line-ending" "file-type"];
|
|
separator = "|";
|
|
};
|
|
soft-wrap = {
|
|
enable = true;
|
|
max-wrap = 25;
|
|
max-indent-retain = 0;
|
|
wrap-indicator = "";
|
|
};
|
|
};
|
|
keys = {
|
|
insert.C-c = "normal_mode";
|
|
normal = {
|
|
esc = ["collapse_selection" "keep_primary_selection"];
|
|
space = {
|
|
space = "file_picker";
|
|
w = ":w";
|
|
q = ":q";
|
|
x = ":x";
|
|
n = ":n";
|
|
"," = "goto_previous_buffer";
|
|
"." = "goto_next_buffer";
|
|
l = ":reflow";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
languages = {
|
|
language-server = with lib; {
|
|
clangd.command = "${pkgs.clang-tools}/bin/clangd";
|
|
markdown-oxide.command = getExe pkgs.markdown-oxide;
|
|
# nil.command = getExe pkgs.nil;
|
|
nixd.command = getExe pkgs.nixd;
|
|
# rust-analyzer.command = getExe pkgs.rust-analyzer;
|
|
# texlab.command = getExe pkgs.texlab;
|
|
tinymist.command = getExe pkgs.tinymist;
|
|
};
|
|
language = [
|
|
{
|
|
name = "nix";
|
|
auto-format = true;
|
|
formatter.command = lib.getExe pkgs.alejandra;
|
|
language-servers = ["nixd"];
|
|
}
|
|
# {
|
|
# name = "latex";
|
|
# auto-format = true;
|
|
# formatter.command = "${pkgs.texlivePackages.latexindent}/bin/latexindent";
|
|
# language-servers = ["texlab"];
|
|
# }
|
|
{
|
|
name = "typst";
|
|
auto-format = true;
|
|
formatter.command = lib.getExe pkgs.typstyle;
|
|
language-servers = ["tinymist"];
|
|
}
|
|
{
|
|
name = "markdown";
|
|
# auto-format = true;
|
|
# formatter.command = "${pkgs.comrak}/bin/comrak";
|
|
language-servers = ["markdown-oxide"];
|
|
}
|
|
{
|
|
name = "c";
|
|
auto-format = true;
|
|
formatter.command = "${pkgs.clang-tools}/bin/clang-format";
|
|
}
|
|
{
|
|
name = "cpp";
|
|
auto-format = true;
|
|
formatter.command = "${pkgs.clang-tools}/bin/clang-format";
|
|
}
|
|
# {
|
|
# name = "rust";
|
|
# auto-format = true;
|
|
# language-servers = ["rust-analyzer"];
|
|
# formatter.command = lib.getExe pkgs.rustfmt;
|
|
# }
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|