From c72401bbe72752a8e9612d463dc0b082e92b035f Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 17 May 2024 15:28:57 +0300 Subject: [PATCH] neovim: use filetype.detect instead --- flake.lock | 8 ++++---- neovim/dev.nix | 18 ++++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index 14d139b..fbda986 100644 --- a/flake.lock +++ b/flake.lock @@ -281,11 +281,11 @@ ] }, "locked": { - "lastModified": 1715941536, - "narHash": "sha256-UDGYgNLwDT7T0y2kgt/H/DckfirnObuBFKWLQUpYqY0=", + "lastModified": 1715948824, + "narHash": "sha256-oaskTqPfJ5J0xXHW6wA7DpUZRMagKJSlQ6RdkETlx4s=", "ref": "refs/heads/main", - "rev": "4f8b523579c4afe8d419e453a42bc0a7a706ea9a", - "revCount": 68, + "rev": "37156d182b912a8ecb575157f6ac002d68c4483b", + "revCount": 70, "type": "git", "url": "https://git.pleshevski.ru/pleshevskiy/nixeovim" }, diff --git a/neovim/dev.nix b/neovim/dev.nix index 717ae98..1a6470d 100644 --- a/neovim/dev.nix +++ b/neovim/dev.nix @@ -4,14 +4,6 @@ let inherit (lib.mod) ctrl; 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 }: { "line-limiter-${toString limit}" = { event = [ "BufNewFile" "BufRead" ]; @@ -25,16 +17,18 @@ in "${modulesPath}/profiles/recommended.nix" ]; + 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 [ - (mkFiletypeDetect "d2" "*.d2") - (mkFiletypeDetect "nickel" "*.ncl") - (mkFiletypeDetect "psql" "*.psql") - (mkLineLimiterGroup { limit = 101; pattern = [