forked from UniverseBow/flake
init (cerulean template)
This commit is contained in:
commit
1b7b1e66f0
65 changed files with 5597 additions and 0 deletions
164
homes/modules/editor/helix.nix
Executable file
164
homes/modules/editor/helix.nix
Executable file
|
|
@ -0,0 +1,164 @@
|
|||
{pkgs, ...}: let
|
||||
lsps = {
|
||||
bash-language-server = {
|
||||
pkg = pkgs.bash-language-server;
|
||||
cmd = "bash-language-server";
|
||||
};
|
||||
|
||||
# TODO: once upgraded past Nix-24.07 this line won't be necessary (I think)
|
||||
# helix will support nixd by default
|
||||
# SOURCE: https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md#Helix
|
||||
nixd = {
|
||||
pkg = pkgs.nixd;
|
||||
cmd = "nixd";
|
||||
};
|
||||
|
||||
ty = {
|
||||
pkg = pkgs.ty; # DEBUG: upkgs.ty;
|
||||
cmd = "ty";
|
||||
};
|
||||
};
|
||||
in {
|
||||
home.packages =
|
||||
lsps
|
||||
|> builtins.attrValues
|
||||
|> map (lsp: lsp.pkg);
|
||||
|
||||
# REF: https://docs.helix-editor.com/editor.html
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
settings = {
|
||||
theme = "dracula";
|
||||
|
||||
editor = {
|
||||
line-number = "absolute";
|
||||
popup-border = "all";
|
||||
scroll-lines = 3;
|
||||
color-modes = true; # colour the mode indicator depending on mode
|
||||
shell = ["bash" "-c"];
|
||||
|
||||
auto-format = true;
|
||||
auto-completion = true; # enable popup for autocomplete
|
||||
completion-timeout = 250; # time before completions display
|
||||
preview-completion-insert = true;
|
||||
completion-trigger-len = 2; # min word length to trigger completions
|
||||
completion-replace = true; # completions replace entire word
|
||||
|
||||
indent-heuristic = "tree-sitter"; # how indentation is computed
|
||||
middle-click-paste = true;
|
||||
insert-final-newline = true; # append newline to file on write
|
||||
|
||||
gutters = [
|
||||
"diagnostics"
|
||||
"spacer"
|
||||
"line-numbers"
|
||||
"spacer"
|
||||
"diff"
|
||||
];
|
||||
|
||||
whitespace = {
|
||||
render = {
|
||||
space = "none"; # "all"
|
||||
tab = "none"; #"all"
|
||||
nbsp = "none";
|
||||
nnbsp = "none";
|
||||
newline = "none";
|
||||
};
|
||||
characters = {
|
||||
space = "·";
|
||||
nbsp = "⍽";
|
||||
nnbsp = "␣";
|
||||
tab = "→";
|
||||
newline = "⤶";
|
||||
tabpad = "·"; # Tabs will look like "→···" (depending on tab width)
|
||||
};
|
||||
};
|
||||
|
||||
indent-guides = {
|
||||
render = true;
|
||||
character = "▏"; # "|"
|
||||
skip-levels = 1;
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = true;
|
||||
auto-signature-help = true; # hints for function parameters
|
||||
display-inlay-hints = true; # inline hints
|
||||
snippets = true;
|
||||
};
|
||||
|
||||
cursor-shape = {
|
||||
normal = "block";
|
||||
insert = "bar";
|
||||
select = "block";
|
||||
};
|
||||
|
||||
file-picker = {
|
||||
hidden = true; # show hidden files
|
||||
follow-symlinks = true;
|
||||
deduplicate-links = true;
|
||||
git-ignore = true; # dont read .gitignore files
|
||||
ignore = true; # use .ignore for helix instead of .gitignore
|
||||
};
|
||||
|
||||
statusline = {
|
||||
left = [
|
||||
"mode"
|
||||
"spacer"
|
||||
"version-control"
|
||||
"spinner"
|
||||
];
|
||||
center = [
|
||||
"file-name"
|
||||
"read-only-indicator"
|
||||
"file-modification-indicator"
|
||||
];
|
||||
right = [
|
||||
"position"
|
||||
"total-line-numbers"
|
||||
"file-encoding"
|
||||
"file-line-ending"
|
||||
"file-type"
|
||||
];
|
||||
separator = "|";
|
||||
mode.normal = "NORMAL";
|
||||
mode.insert = "INSERT";
|
||||
mode.select = "SELECT";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
languages = {
|
||||
language = [
|
||||
{
|
||||
name = "nix";
|
||||
indent = {
|
||||
tab-width = 2;
|
||||
unit = " ";
|
||||
};
|
||||
block-comment-tokens = {
|
||||
start = "/*";
|
||||
end = "*/";
|
||||
};
|
||||
auto-format = true;
|
||||
formatter.command = "${pkgs.alejandra}/bin/alejandra";
|
||||
language-servers = ["nixd"];
|
||||
}
|
||||
{
|
||||
name = "python";
|
||||
indent = {
|
||||
tab-width = 4;
|
||||
unit = " ";
|
||||
};
|
||||
auto-format = true;
|
||||
rulers = [80];
|
||||
language-servers = ["ty"];
|
||||
}
|
||||
];
|
||||
|
||||
language-server =
|
||||
lsps
|
||||
|> builtins.mapAttrs (_: lsp: {command = "${lsp.pkg}/bin/${lsp.cmd}";});
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue