neovim: update configs

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-17 22:26:17 +03:00
parent da54985039
commit cad385b8a7
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 49 additions and 42 deletions

View file

@ -281,11 +281,11 @@
]
},
"locked": {
"lastModified": 1715948824,
"narHash": "sha256-oaskTqPfJ5J0xXHW6wA7DpUZRMagKJSlQ6RdkETlx4s=",
"lastModified": 1715970214,
"narHash": "sha256-x9bHVtPmk5BfGmVLfUhFcpVJdQZ5SstBRFy19WBp/W0=",
"ref": "refs/heads/main",
"rev": "37156d182b912a8ecb575157f6ac002d68c4483b",
"revCount": 70,
"rev": "51fcb9d9e41d9ac540a9840081fdce328e2117e0",
"revCount": 73,
"type": "git",
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
},

View file

@ -2,13 +2,16 @@
let
inherit (lib.mod) ctrl;
inherit (lib.nix2lua) lambda0 set pipe1 require call call0;
inherit (lib.nix2lua) pipe1 require call call0;
mkLineLimiterGroup = { limit, pattern }: {
"line-limiter-${toString limit}" = {
event = [ "BufNewFile" "BufRead" ];
inherit pattern;
callback = lambda0 (set "vim.wo.colorcolumn" (toString limit));
mkLineLimiterGroup = { limit, filetypes }:
lib.nameValuePair
"line-limiter-${toString limit}"
{
inherit filetypes;
opt = {
colorcolumn = toString limit;
textwidth = limit;
};
};
in
@ -17,45 +20,49 @@ in
"${modulesPath}/profiles/recommended.nix"
];
vim.opt = {
list = true;
formatexpr = "neoformat#Neoformat(0, '', v:lnum, v:lnum + v:count)";
};
buffer = {
nix.opt.formatexpr = "neoformat#Neoformat(0, '', 0, 99999)";
} // lib.listToAttrs [
(mkLineLimiterGroup {
limit = 101;
filetypes = [
"nix"
"javascript,javascriptreact"
"typescript,typescriptreact"
"rust"
"haskell"
];
})
(mkLineLimiterGroup {
limit = 81;
filetypes = [
"json"
"yaml"
"markdown"
"html"
"css"
"scss"
"less"
"sql"
"psql"
];
})
];
filetype.detect = {
d2 = "*.d2";
nickel = "*.ncl";
psql = "*.psql";
};
vim.opt.list = true;
# Enable fast navigation between windows
vim.keymap.set = map (k: { mode = "n"; lhs = ctrl k; rhs = "${ctrl "w"}${k}"; }) [ "h" "l" "j" "k" ];
vim.augroup = lib.mkMerge [
(mkLineLimiterGroup {
limit = 101;
pattern = [
"*.nix"
"*.ts"
"*.tsx"
"*.js"
"*.jsx"
"*.rs"
"*.hs"
];
})
(mkLineLimiterGroup {
limit = 81;
pattern = [
"*.json"
"*.yml"
"*.yaml"
"*.md"
"*.html"
"*.css"
"*.scss"
"*.less"
];
})
];
plugins.style.nvim-treesitter.extraGrammars = {
tree-sitter-d2 = rec {
language = "d2";