Skip to content

Commit

Permalink
Use nvim_exec2 if exists in vusted.helper
Browse files Browse the repository at this point in the history
  • Loading branch information
notomo committed Mar 26, 2023
1 parent f09e04b commit ace1de8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/vusted/helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ local clears = {
vim.cmd("lmapclear")
end,
autocmd = function()
local groups = vim.split(vim.api.nvim_exec("augroup", true), "%s+", { trimempty = true })
local exec = function(cmd)
if vim.api.nvim_exec2 then
return vim.api.nvim_exec2(cmd, { output = true }).output
end
return vim.api.nvim_exec(cmd, true)
end
local groups = vim.split(exec("augroup"), "%s+", { trimempty = true })
for _, group in ipairs(groups) do
vim.api.nvim_del_augroup_by_name(group)
end
Expand Down

0 comments on commit ace1de8

Please sign in to comment.