Files
dotfiles/home-modules/helix.nix
Lennart J. Kurzweg (Nx2) cbe9371e66 better hotkeys
2024-09-04 17:12:41 +02:00

312 lines
8.6 KiB
Nix

{ pkgs, pkgs-unstable,lib, rice, ... }:
{
home = {
packages = with pkgs; [
nixfmt-classic # nix formater
nil # nix language server
python311Packages.python-lsp-server
ruff
ruff-lsp
pyright
lldb # debugger for llvm stuff
yaml-language-server # yaml
marksman # markdown
vale-ls # style-checker lsp (needs vale)
ltex-ls # Ltex (language tool)
] ++ (with pkgs-unstable; [
helix
]);
sessionVariables = {
EDITOR = "hx";
VISUAL = "hx";
};
};
programs.helix = {
enable = true;
defaultEditor = true;
package = pkgs-unstable.helix;
settings = {
# theme = "base16_terminal";
theme = "base16";
editor = {
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
soft-wrap = {
enable = true;
};
line-number = "relative";
color-modes = true;
bufferline = "always";
popup-border = "all";
completion-trigger-len = 1;
completion-timeout = 5;
file-picker.hidden = false;
middle-click-paste = false;
cursorline = true;
indent-guides = {
render = true;
character = "";
};
lsp.display-inlay-hints = true;
statusline.center = [ "position-percentage" ];
true-color = true;
whitespace.characters = {
newline = "";
tab = "";
skip-levels = 1;
};
};
keys.normal = {
"C-g" = [":new" ":insert-output lazygit" ":buffer-close!" ":redraw"];
"A-`" = [ "no_op" ];
"`" = [ "no_op" ];
};
keys.normal."ö" = {
"s" = [ "switch_case" ];
"u" = [ "switch_to_uppercase" ];
"l" = [ "switch_to_lowercase" ];
};
};
languages = {
language = [
# {
# name = "latex";
# language-servers = ["texlab" "spellchek"];
# }
{
name = "markdown";
# language-servers = [ "marksman" "style-check" "language-tool" ];
language-servers = [ "language-tool" "marksman" ];
file-types = [ "md" "MD" ];
scope = "text.<name>";
}
{
name = "python";
language-servers = [ "pyright" "ruff" ];
formatter = {
command = "ruff";
args = [
"format"
"--line-length"
"120"
"-"
];
};
debugger = {
name = "debugpy";
transport = "stdio";
command = "python";
args = [ "-m" "debugpy.adapter" ];
templates = [{
name = "source";
request = "launch";
completion = [{
name = "entrypoint";
completion = "filename";
default = ".";
}];
args = {
mode = "debug";
program = "{0}";
};
}];
};
}
];
language-server = {
"style-check" = {
command = lib.getExe pkgs.vale-ls;
};
"language-tool" = {
command = "${pkgs.ltex-ls}/bin/ltex-ls";
};
"ruff" = {
command = "ruff-lsp";
config.settings.args = [
# Set line length
# "--line-length"
# "79"
# Enable some ruff rules
# "--select"
# (
# "F,W,E,I,N,D200,D201,D202,D203,D204,D205,D206,D207,D208,D209,D210,D211,"
# + "D212,D213,D214,D215,D300,D301,D400,D401,D402,D403,D404,D405,D406,"
# + "D407,D408,D409,D410,D411,D412,D413,D414,D415,D416,D417,D418,D419,"
# + "UP,YTT,TRIO,ASYNC,B,A,COM,C4,DTZ,T10,DJ,EXE,FA,ISC,ICN001,G010,"
# + "G101,G201,G202,INP,PIE,Q,RSE,RET,SLOT,SIM,TCH,INT,ARG,PTH,TD001,"
# + "TD004,TD005,TD006,TD007,PD,PL,TRY004,TRY200,TRY201,TRY302,TRY400,"
# + "TRY401,FLY,NPY,AIR,PERF,FURB,LOG,RUF"
# )
];
};
};
};
themes = {
base16 = with rice.color; {
"attributes" = foreground;
"comment" = {
"fg" = white.dark;
"modifiers" = [ "italic" ];
};
"constant" = accent.bright;
"constant.character.escape" = special.bright;
"constant.numeric" = foreground;
"constructor" = weird.base;
"debug" = yellow.base;
"diagnostic.modifiers" = [ "underlined" ];
"diff.delta" = blue.bright;
"diff.minus" = negative.bright;
"diff.plus" = positive.bright;
"error" = red.base;
"function" = secondary.bright;
"hint" = tertiary.bright;
"info" = foreground;
"keyword" = special.base;
"label" = foreground;
"namespace" = weird.bright;
"operator" = foreground;
"special" = special.base;
"string" = secondary.bright;
"type" = red.base;
"variable" = accent.base;
"variableother.member" = foreground;
"warning" = red.base;
"markup.heading" = accent.base;
"markup.bold" = {
"fg" = tertiary.bright;
"modifiers" = [ "bold" ];
};
"italic" = {
"fg" = secondary.bright;
"modifiers" = [ "italic" ];
};
"markup.linktext" = accent.base;
"markup.linkurl" = {
"fg" = tertiary.dark;
"modifiers" = [ "underlined" ];
};
"markup.list" = accent.bright;
"markup.quote" = weird.bright;
"markup.raw" = special.bright;
"markup.strikethrough" = {
"modifiers" = [ "crossed_out" ];
};
"diagnostic.hint" = {
"underline" = { style = "curl"; };
};
"diagnostic.info" = {
"underline" = { style = "curl"; };
};
"diagnostic.warning" = {
"underline" = { style = "curl"; };
};
"diagnostic.error" = {
"underline" = { style = "curl"; };
};
"ui.background" = { # general background of the editor window
"bg" = background;
};
"ui.bufferline" = { # the top line ("tab"-line)
"fg" = accent.base;
"bg" = black.base;
};
"ui.bufferline.active" = { # the active "tab"
"fg" = background;
"bg" = accent.base;
"modifiers" = [ "bold" ];
};
"ui.cursor" = { # the cursor in Normal mode
"fg" = foreground;
"modifiers" = [ "reversed" ];
};
"ui.cursorline.primary" = { # the line on which the cursor is on
"bg" = black.base;
};
"ui.cursor.match" = { # Matching bracket etc.
"bg" = green.dark;
"modifiers" = [ "reversed" ];
};
"ui.gutter" = {
"bg" = black.base;
};
"ui.help" = {
"fg" = green.base;
"bg" = black.base;
};
"ui.linenr" = {
"fg" = white.dark;
"bg" = black.base;
};
"ui.linenr.selected" = {
"fg" = accent.bright;
"modifiers" = [ "bold" ];
};
"ui.menu" = {
"fg" = accent.base;
"bg" = black.base;
};
"ui.menu.scroll" = {
"fg" = yellow.dark;
"bg" = background;
};
"ui.menu.selected" = {
"fg" = red.base;
"bg" = blue.dark;
};
"ui.popup" = {
"bg" = black.base;
};
"ui.selection" = {
"bg" = white.dark;
};
"ui.selection.primary" = {
"bg" = black.bright;
};
"ui.statusline" = {
"fg" = blue.bright;
"bg" = black.base;
};
"ui.statusline.inactive" = {
"fg" = red.bright;
"bg" = red.dark;
};
"ui.statusline.insert" = {
"fg" = green.bright;
"bg" = green.dark;
};
"ui.statusline.normal" = {
"fg" = yellow.bright;
"bg" = yellow.dark;
};
"ui.statusline.select" = {
"fg" = cyan.bright;
"bg" = cyan.dark;
};
"ui.text" = foreground;
"ui.text.focus" = accent.base;
"ui.virtual.indent-guide" = {
"fg" = black.bright;
};
"ui.virtual.inlay-hint" = {
"fg" = weird.bright;
"bg" = weird.dark;
};
"ui.virtual.ruler" = {
"bg" = background;
};
"ui.window" = {
"bg" = black.base;
};
};
};
};
}