From 335d6056ea6d7557de29dfc67650f7077a87d079 Mon Sep 17 00:00:00 2001 From: xfzv <> Date: Fri, 17 May 2024 23:32:19 +0200 Subject: [PATCH] use `vim.islist()` instead of deprecated `vim.tbl_islist()` `vim.tbl_islist()` is deprecated and will be removed in Neovim 0.12. This causes depcrecation warnings on 0.11. ref: https://github.com/neovim/neovim/blob/512d228111bccf3e52613c798edc7f803c1de13f/runtime/doc/deprecated.txt#L68 --- lua/legendary/data/keymap.lua | 6 ++++-- lua/legendary/init.lua | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/legendary/data/keymap.lua b/lua/legendary/data/keymap.lua index f272b540..be534b4e 100644 --- a/lua/legendary/data/keymap.lua +++ b/lua/legendary/data/keymap.lua @@ -109,7 +109,8 @@ end ---Bind the keymap in Neovim ---@return Keymap function Keymap:apply() - if vim.tbl_islist(self.mode_mappings) then + local islist = vim.islist or vim.tbl_islist + if islist(self.mode_mappings) then -- description-only keymap return self end @@ -133,7 +134,8 @@ function Keymap:frecency_id() end function Keymap:modes() - if vim.tbl_islist(self.mode_mappings) then + local islist = vim.islist or vim.tbl_islist + if islist(self.mode_mappings) then return self.mode_mappings end diff --git a/lua/legendary/init.lua b/lua/legendary/init.lua index d57cc6b0..374de970 100644 --- a/lua/legendary/init.lua +++ b/lua/legendary/init.lua @@ -35,7 +35,8 @@ local function build_parser_func(parser) return end - if not vim.tbl_islist(items) then + local islist = vim.islist or vim.tbl_islist + if not islist(items) then error(string.format('Expected list, got ', type(items))) return end @@ -159,7 +160,8 @@ end ---Bind a *list of* autocmds and/or augroups ---@param aus table function M.autocmds(aus) - if not vim.tbl_islist(aus) then + local islist = vim.islist or vim.tbl_islist + if not islist(aus) then Log.error('Expected list, got %s.\n %s', type(aus), vim.inspect(aus)) return end