system/neovim/configs/line-limiter.nix

48 lines
859 B
Nix

{ lib, ... }:
let
mkLineLimiterOpts = limit: {
colorcolumn = toString (limit + 1);
textwidth = limit;
};
mkLineLimiterGroup = { limit, pattern }:
lib.nameValuePair
"line-limiter-${toString limit}"
{
inherit pattern;
opt = mkLineLimiterOpts limit;
};
in
{
buffer.filetype = lib.listToAttrs [
(mkLineLimiterGroup {
limit = 100;
pattern = [
"nix"
"javascript,javascriptreact"
"typescript,typescriptreact"
"vue"
"rust"
"haskell"
];
})
(mkLineLimiterGroup {
limit = 90;
pattern = [
"python"
];
})
(mkLineLimiterGroup {
limit = 80;
pattern = [
"json"
"yaml"
"markdown"
"html,htmldjango"
"css,scss,less"
"sql,psql"
];
})
];
}