enhace: Use nvim_call_function instead of vim.fn so vim.fn does not get populated

This commit is contained in:
shadmansaleh 2021-08-28 00:13:50 +06:00
parent 1c57d7e61c
commit 2348eaea2f
1 changed files with 1 additions and 1 deletions

View File

@ -25,7 +25,7 @@ end
EvalFuncComponent.vim_function = function(name) EvalFuncComponent.vim_function = function(name)
-- vim function component -- vim function component
local ok, return_val = pcall(vim.fn[name]) local ok, return_val = pcall(vim.api.nvim_call_function, name, {})
if not ok then return '' end -- function call failed if not ok then return '' end -- function call failed
ok, return_val = pcall(tostring, return_val) ok, return_val = pcall(tostring, return_val)
return ok and return_val or '' return ok and return_val or ''