neovim: refac line limiter

This commit is contained in:
Dmitriy Pleshevskiy 2024-06-09 16:50:35 +03:00
parent 9cda7b1c76
commit b9fe063b50
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -4,15 +4,17 @@ let
inherit (lib.mod) ctrl;
inherit (lib.nix2lua) pipe1 require call call0 nf var;
mkLineLimiterOpts = limit: {
colorcolumn = toString (limit + 1);
textwidth = limit;
};
mkLineLimiterGroup = { limit, pattern }:
lib.nameValuePair
"line-limiter-${toString limit}"
{
inherit pattern;
opt = {
colorcolumn = toString limit;
textwidth = limit - 1;
};
opt = mkLineLimiterOpts limit;
};
in
{
@ -28,7 +30,7 @@ in
buffer.filetype = lib.listToAttrs [
(mkLineLimiterGroup {
limit = 101;
limit = 100;
pattern = [
"nix"
"javascript,javascriptreact"
@ -38,7 +40,7 @@ in
];
})
(mkLineLimiterGroup {
limit = 81;
limit = 80;
pattern = [
"python"
"json"