133 lines
3.6 KiB
Nix
133 lines
3.6 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}: let
|
|
tomlFormat = pkgs.formats.toml {};
|
|
configFilePath = "~/.config/helix/config.toml";
|
|
installConfig = file: ''
|
|
${pkgs.coreutils}/bin/ln -sf ${file} ${configFilePath}
|
|
'';
|
|
|
|
lightConfig = {
|
|
theme = "papercolor-light";
|
|
editor = {
|
|
line-number = "relative";
|
|
mouse = true;
|
|
#cursorline = true;
|
|
#color-modes = true;
|
|
cursor-shape = {
|
|
insert = "bar";
|
|
};
|
|
idle-timeout = 50;
|
|
soft-wrap.enable = true;
|
|
statusline.left = ["mode" "spinner" "file-name" "file-modification-indicator" "spacer" "version-control"];
|
|
lsp.display-inlay-hints = true;
|
|
};
|
|
keys.normal.space = {
|
|
o.j = ":pipe ${pkgs.jq}/bin/jq --sort-keys --indent 4";
|
|
};
|
|
};
|
|
lightConfigFile = tomlFormat.generate "config.toml" lightConfig;
|
|
|
|
darkConfig = lib.recursiveUpdate lightConfig {
|
|
theme = "gruvbox";
|
|
};
|
|
darkConfigFile = tomlFormat.generate "config.toml" darkConfig;
|
|
|
|
extraLanguages = (pkgs.formats.toml {}).generate "languages.toml" {
|
|
language-server = {
|
|
beancount-language-server = {
|
|
name = "beancount-language-server";
|
|
command = "${pkgs.beancount-language-server}/bin/beancount-language-server";
|
|
args = ["--stdio"];
|
|
config.journal_file = "/home/malte/repos/accounting/main.bean";
|
|
};
|
|
vuels = {
|
|
name = "vuels";
|
|
command = "vls";
|
|
config = {
|
|
typescript.serverPath = "${pkgs.nodePackages.typescript}/lib/node_modules/typescript/lib/tsserverlibrary.js";
|
|
languageFeatures = {
|
|
semanticTokens = true;
|
|
references = true;
|
|
definition = true;
|
|
typeDefinition = true;
|
|
callHierarchy = true;
|
|
hover = true;
|
|
rename = true;
|
|
renameFileRefactoring = true;
|
|
signatureHelp = true;
|
|
codeAction = true;
|
|
completion = {
|
|
defaultTagNameCase = "both";
|
|
defaultAttrNameCase = "kebabCase";
|
|
};
|
|
schemaRequestService = true;
|
|
documentHighlight = true;
|
|
documentLink = true;
|
|
codeLens = true;
|
|
diagnostics = true;
|
|
};
|
|
documentFeatures = {
|
|
documentColor = false;
|
|
selectionRange = true;
|
|
foldingRange = true;
|
|
linkedEditingRange = true;
|
|
documentSymbol = true;
|
|
documentFormatting.defaultPrintWidth = 100;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
language = [
|
|
{
|
|
name = "beancount";
|
|
language-servers = [
|
|
{
|
|
name = "beancount-language-server";
|
|
}
|
|
];
|
|
}
|
|
{
|
|
name = "vue";
|
|
file-types = ["vue"];
|
|
language-servers = ["vuels"];
|
|
scope = "source.vue";
|
|
roots = ["package.json"];
|
|
injection-regex = "vue";
|
|
auto-format = false;
|
|
indent = {
|
|
tab-width = 4;
|
|
unit = " ";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
in {
|
|
home.packages = with pkgs; [
|
|
helix
|
|
# Some helpful language servers
|
|
yaml-language-server
|
|
python311Packages.python-lsp-server
|
|
nodePackages.bash-language-server
|
|
taplo-lsp
|
|
];
|
|
|
|
home.sessionVariables = {
|
|
EDITOR = "${pkgs.helix}/bin/hx";
|
|
VISUAL = "${pkgs.kitty}/bin/kitty ${pkgs.helix}/bin/hx";
|
|
};
|
|
|
|
xdg.configFile."helix/languages.toml".source = extraLanguages;
|
|
|
|
services.darkman.lightModeScripts."helix.sh" = ''
|
|
mkdir -p $(dirname ${configFilePath})
|
|
${installConfig lightConfigFile}
|
|
'';
|
|
services.darkman.darkModeScripts."helix.sh" = ''
|
|
mkdir -p $(dirname ${configFilePath})
|
|
${installConfig darkConfigFile}
|
|
'';
|
|
}
|