nixos-config/user/helix.nix

155 lines
3.8 KiB
Nix
Raw Normal View History

2024-06-05 01:18:48 -03:00
{
pkgs,
lib,
config,
...
}:
let
2024-06-05 01:18:48 -03:00
inherit (config.my) accent theme editor;
inherit (theme) color;
in
{
2022-08-04 23:50:58 -03:00
config = {
programs.helix = {
enable = true;
settings = {
2023-01-24 10:07:04 -03:00
theme = "my-theme";
2022-08-04 23:50:58 -03:00
editor = {
2023-01-24 10:07:04 -03:00
cursorline = true;
2023-05-08 17:25:08 -03:00
cursorcolumn = true;
2023-01-24 10:07:04 -03:00
auto-save = true;
2023-05-08 17:25:08 -03:00
line-number = "relative";
2022-08-04 23:50:58 -03:00
whitespace.render = "all";
whitespace.characters = {
space = "·";
tab = "";
newline = "¬";
};
2023-05-08 17:25:08 -03:00
lsp = {
display-messages = true;
display-inlay-hints = true;
};
cursor-shape = {
insert = "bar";
};
indent-guides.render = true;
soft-wrap.enable = true;
2022-08-04 23:50:58 -03:00
};
keys.normal = {
# basic movement
n = "move_char_left";
e = "move_line_down";
i = "move_line_up";
o = "move_char_right";
# search
l = "search_next";
L = "search_prev";
# edits
s = "insert_mode";
# open newline
h = "open_below";
H = "open_above";
# selections
k = "select_regex";
K = "split_selection";
"C-k" = "split_selection_on_newline";
# goto mode
g.n = "goto_line_start";
g.o = "goto_line_end";
2024-09-06 00:10:22 -03:00
# Formatting
"space".m = ":format";
2022-08-04 23:50:58 -03:00
};
keys.select = {
# basic movement
n = "extend_char_left";
e = "extend_line_down";
i = "extend_line_up";
o = "extend_char_right";
# search
2023-04-24 11:56:42 -03:00
l = "extend_search_next";
L = "extend_search_prev";
2022-08-04 23:50:58 -03:00
# edits
s = "insert_mode";
2024-09-06 00:10:22 -03:00
S = "insert_at_line_start";
2022-08-04 23:50:58 -03:00
# open newline
h = "open_below";
H = "open_above";
# selections
k = "select_regex";
K = "split_selection";
"C-k" = "split_selection_on_newline";
# goto mode
g.n = "goto_line_start";
g.o = "goto_line_end";
};
keys.insert = {
"A-k" = "normal_mode";
};
2022-08-04 23:50:58 -03:00
};
2023-06-02 22:42:56 -03:00
languages.language = [
2023-10-02 15:58:59 -03:00
{
2024-02-10 00:10:16 -03:00
name = "nix";
auto-format = true;
2024-09-06 00:10:22 -03:00
formatter.command = "nixfmt";
2024-02-10 00:10:16 -03:00
}
{
name = "rust";
auto-format = true;
2023-10-02 15:58:59 -03:00
}
2023-01-24 10:07:04 -03:00
];
2023-06-02 22:42:56 -03:00
2024-02-10 00:10:16 -03:00
languages.language-server = {
intelephense.config.intelephense.format.braces = "k&r";
};
2023-04-24 11:56:42 -03:00
themes = {
my-theme = {
"inherits" = "gruvbox";
"ui.menu" = "none";
"ui.background" = {
bg = "none";
};
2023-04-24 11:56:42 -03:00
"ui.virtual.whitespace" = color.nontxt;
"ui.cursor.primary" = {
fg = accent.fg;
bg = accent.color;
};
"ui.cursorline.primary" = {
bg = color.bg_dark;
};
"ui.cursorcolumn.primary" = {
modifiers = [ "bold" ];
};
"ui.cursorline" = {
bg = "none";
};
"ui.cursorcolumn" = {
bg = "none";
};
"ui.linenr.selected" = {
fg = color.txt;
};
2023-05-08 17:25:08 -03:00
function = color.normal.orange;
module = color.normal.brown;
palette = {
yellow0 = color.normal.yellow;
yellow1 = color.normal.yellow;
green0 = color.normal.green;
green1 = color.normal.green;
purple0 = color.normal.magenta;
purple1 = color.normal.magenta;
fg0 = color.txt;
fg1 = color.txt;
fg2 = color.txt;
fg3 = color.txt;
fg4 = color.txt;
};
2023-01-24 10:07:04 -03:00
};
2023-04-24 11:56:42 -03:00
};
2022-08-04 23:50:58 -03:00
};
home.sessionVariables = lib.mkIf (editor == "helix") { EDITOR = "hx"; };
2022-08-04 23:50:58 -03:00
};
}