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": { "locked": {
"lastModified": 1715948824, "lastModified": 1715970214,
"narHash": "sha256-oaskTqPfJ5J0xXHW6wA7DpUZRMagKJSlQ6RdkETlx4s=", "narHash": "sha256-x9bHVtPmk5BfGmVLfUhFcpVJdQZ5SstBRFy19WBp/W0=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "37156d182b912a8ecb575157f6ac002d68c4483b", "rev": "51fcb9d9e41d9ac540a9840081fdce328e2117e0",
"revCount": 70, "revCount": 73,
"type": "git", "type": "git",
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim" "url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
}, },

View file

@ -2,60 +2,67 @@
let let
inherit (lib.mod) ctrl; inherit (lib.mod) ctrl;
inherit (lib.nix2lua) lambda0 set pipe1 require call call0; inherit (lib.nix2lua) pipe1 require call call0;
mkLineLimiterGroup = { limit, pattern }: { mkLineLimiterGroup = { limit, filetypes }:
"line-limiter-${toString limit}" = { lib.nameValuePair
event = [ "BufNewFile" "BufRead" ]; "line-limiter-${toString limit}"
inherit pattern; {
callback = lambda0 (set "vim.wo.colorcolumn" (toString limit)); inherit filetypes;
}; opt = {
}; colorcolumn = toString limit;
textwidth = limit;
};
};
in in
{ {
imports = [ imports = [
"${modulesPath}/profiles/recommended.nix" "${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 = { filetype.detect = {
d2 = "*.d2"; d2 = "*.d2";
nickel = "*.ncl"; nickel = "*.ncl";
psql = "*.psql"; psql = "*.psql";
}; };
vim.opt.list = true;
# Enable fast navigation between windows # Enable fast navigation between windows
vim.keymap.set = map (k: { mode = "n"; lhs = ctrl k; rhs = "${ctrl "w"}${k}"; }) [ "h" "l" "j" "k" ]; 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 = { plugins.style.nvim-treesitter.extraGrammars = {
tree-sitter-d2 = rec { tree-sitter-d2 = rec {
language = "d2"; language = "d2";