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