{ lib, formats, concatTextFile, writeTextDir, symlinkJoin, }: let tomlFormat = formats.toml { }; config = { theme = "tokyonight"; editor = { line-number = "relative"; indent-guides = { render = true; character = "┆"; skip-levels = 1; }; cursor-shape = { insert = "bar"; normal = "block"; select = "underline"; }; whitespace.render = { space = "all"; tab = "all"; newline = "none"; }; whitespace.characters = { space = "·"; nbsp = "⍽"; tab = "→"; newline = "⏎"; tabpad = "·"; # Tabs will look like "→···" (depending on tab width) }; cursorline = true; lsp.display-messages = true; }; keys.normal."space" = { "f" = "file_picker_in_current_directory"; "F" = "file_picker"; }; }; languages = { language-server.emmet-ls = { command = "emmet-ls"; args = [ "--stdio" ]; }; # language-server.astro-ls = { # command = "astro-ls"; # args = [ "--stdio" ]; # config = { # typescript.tsdk = "${pkgs.typescript}/lib/node_modules/typescript/lib"; # environment = "node"; # }; # }; language = [ { name = "html"; language-servers = [ "vscode-html-language-server" "emmet-ls" ]; } { name = "php"; language-servers = [ "emmet-ls" ]; } { name = "astro"; scope = "source.astro"; injection-regex = "astro"; file-types = [ "astro" ]; roots = [ "package.json" "astro.config.mjs" ]; language-servers = [ "astro-ls" "emmet-ls" ]; auto-format = true; } { name = "nix"; auto-format = true; formatter = { command = "nixfmt"; args = [ "-" ]; }; } { name = "cpp"; auto-format = true; formatter.command = "clang-format"; } { name = "cmake"; auto-format = true; formatter = { command = "cmake-format"; args = [ "-" ]; }; } { name = "svelte"; language-servers = [ "svelteserver" "emmet-ls" ]; } { name = "vue"; language-servers = [ "vue-language-server" "emmet-ls" ]; } ]; }; ignores = [ "*.lock" "!.gitignore" "!.cargo" # Common binary file formats "*.exe" "*.bin" "*.png" "*.jpeg" "*.jpg" "*.webp" ]; config-file = concatTextFile { name = "helix-config-toml"; files = [ (tomlFormat.generate "helix-config" config) ]; destination = "/helix/config.toml"; }; languages-file = concatTextFile { name = "helix-languages-toml"; files = [ (tomlFormat.generate "helix-languages" languages) ]; destination = "/helix/languages.toml"; }; ignore-file = writeTextDir "helix/ignore" (lib.strings.concatLines ignores); in symlinkJoin { name = "helix-config"; paths = [ config-file languages-file ignore-file ]; }