dist: transpile cfilter.vim => cfilter.lua #21662

Vim has changed cfilter.vim from vimscript to vim9script.
Nvim supports only vimscript, not vim9script.
This commit is contained in:
TJ DeVries
2023-01-08 15:31:38 -05:00
committed by GitHub
parent 266a1c61b9
commit 904c13e6b5
4 changed files with 243 additions and 62 deletions

View File

@@ -27,6 +27,29 @@ local vim9 = (function()
end
end
M.fn_ref = function(module, name, copied, ...)
for _, val in ipairs({ ... }) do
table.insert(copied, val)
end
local funcref = name
if type(funcref) == 'function' then
return funcref(unpack(copied))
elseif type(funcref) == 'string' then
if vim.fn.exists('*' .. funcref) == 1 then
return vim.fn[funcref](unpack(copied))
end
if module[funcref] then
module[funcref](unpack(copied))
end
error('unknown function: ' .. funcref)
else
error(string.format('unable to call funcref: %s', funcref))
end
end
M.fn_mut = function(name, args, info)
local result = vim.fn._Vim9ScriptFn(name, args)
for idx, val in pairs(result[2]) do