neovim: use filetype.detect instead

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-17 15:28:57 +03:00
parent 7e4e7fa182
commit c72401bbe7
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 10 additions and 16 deletions

View file

@ -281,11 +281,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1715941536, "lastModified": 1715948824,
"narHash": "sha256-UDGYgNLwDT7T0y2kgt/H/DckfirnObuBFKWLQUpYqY0=", "narHash": "sha256-oaskTqPfJ5J0xXHW6wA7DpUZRMagKJSlQ6RdkETlx4s=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "4f8b523579c4afe8d419e453a42bc0a7a706ea9a", "rev": "37156d182b912a8ecb575157f6ac002d68c4483b",
"revCount": 68, "revCount": 70,
"type": "git", "type": "git",
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim" "url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
}, },

View file

@ -4,14 +4,6 @@ let
inherit (lib.mod) ctrl; inherit (lib.mod) ctrl;
inherit (lib.nix2lua) lambda0 set pipe1 require call call0; inherit (lib.nix2lua) lambda0 set pipe1 require call call0;
mkFiletypeDetect = ft: pattern: {
"filetype-detect-${ft}" = {
event = [ "BufNewFile" "BufRead" ];
inherit pattern;
command = "setfiletype ${ft}";
};
};
mkLineLimiterGroup = { limit, pattern }: { mkLineLimiterGroup = { limit, pattern }: {
"line-limiter-${toString limit}" = { "line-limiter-${toString limit}" = {
event = [ "BufNewFile" "BufRead" ]; event = [ "BufNewFile" "BufRead" ];
@ -25,16 +17,18 @@ in
"${modulesPath}/profiles/recommended.nix" "${modulesPath}/profiles/recommended.nix"
]; ];
filetype.detect = {
d2 = "*.d2";
nickel = "*.ncl";
psql = "*.psql";
};
vim.opt.list = true; 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 [ vim.augroup = lib.mkMerge [
(mkFiletypeDetect "d2" "*.d2")
(mkFiletypeDetect "nickel" "*.ncl")
(mkFiletypeDetect "psql" "*.psql")
(mkLineLimiterGroup { (mkLineLimiterGroup {
limit = 101; limit = 101;
pattern = [ pattern = [