435 B
435 B
neovim api
执行系统命令
0.10 版本之后
vim.system
0.10.x 版本之前
vim.api.nvim_exec2
查看 table
print(vim.inspect(table))
-- execute system command
local has_cmd = function(cmd)
res = vim.system({'which', cmd}, { text = true}):wait() -- ; print(res.code)
-- no error, everything is ok
if res.code == 0 then
return true
end
-- error
return false
end