mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
vim.fn: throw error when trying to use API function
This commit is contained in:
parent
4a1a86a2be
commit
e65d0e53b1
@ -253,9 +253,17 @@ end
|
||||
-- vim.fn.{func}(...)
|
||||
vim.fn = setmetatable({}, {
|
||||
__index = function(t, key)
|
||||
local function _fn(...)
|
||||
return vim.call(key, ...)
|
||||
local _fn
|
||||
if vim.api[key] ~= nil then
|
||||
_fn = function(...)
|
||||
error(string.format("Tried to call API function with vim.fn: use vim.api.%s() instead", key))
|
||||
end
|
||||
else
|
||||
_fn = function(...)
|
||||
return vim.call(key, ...)
|
||||
end
|
||||
end
|
||||
|
||||
t[key] = _fn
|
||||
return _fn
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user