mirror of
https://github.com/neovim/neovim.git
synced 2025-11-23 10:36:29 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user