123 lines
3.3 KiB
Nix
123 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 = {
|
|
line-number = "relative";
|
|
bufferline = "multiple";
|
|
cursorline = true;
|
|
lsp.display-messages = 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.normal = {
|
|
space = {
|
|
space = "file_picker";
|
|
w = ":w";
|
|
q = ":q";
|
|
x = ":x";
|
|
n = ":n";
|
|
"," = "goto_previous_buffer";
|
|
"." = "goto_next_buffer";
|
|
l = ":reflow";
|
|
};
|
|
esc = ["collapse_selection" "keep_primary_selection"];
|
|
};
|
|
};
|
|
languages = {
|
|
language-server = {
|
|
clangd = {
|
|
command = "${pkgs.clang-tools}/bin/clangd";
|
|
};
|
|
rust-analyzer = {
|
|
command = "${pkgs.rust-analyzer}/bin/rust-analyzer";
|
|
};
|
|
texlab = {
|
|
command = "${pkgs.texlab}/bin/texlab";
|
|
};
|
|
nil = {
|
|
command = "${pkgs.nil}/bin/nil";
|
|
};
|
|
markdown-oxide = {
|
|
command = "${pkgs.markdown-oxide}/bin/markdown-oxide";
|
|
};
|
|
tinymist = {
|
|
command = lib.getExe pkgs.tinymist;
|
|
};
|
|
};
|
|
language = [
|
|
{
|
|
name = "nix";
|
|
auto-format = true;
|
|
formatter.command = "${pkgs.alejandra}/bin/alejandra";
|
|
language-servers = ["nil"];
|
|
}
|
|
{
|
|
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 = "${pkgs.rustfmt}/bin/rustfmt";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|