Skip to content

Commit

Permalink
Merge pull request #454 from xfzv/master
Browse files Browse the repository at this point in the history
refactor: use `vim.islist()` instead of deprecated `vim.tbl_islist()`
  • Loading branch information
mrjones2014 authored May 17, 2024
2 parents aa835a2 + 335d605 commit 38d1f39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lua/legendary/data/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 4 additions & 2 deletions lua/legendary/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 38d1f39

Please sign in to comment.