2021-08-10 21:50:49 +02:00
|
|
|
local M = {}
|
|
|
|
local cmd = vim.cmd
|
|
|
|
|
|
|
|
function M.create_augroup(autocmds, name)
|
|
|
|
cmd('augroup ' .. name)
|
|
|
|
cmd('autocmd!')
|
|
|
|
for _, autocmd in ipairs(autocmds) do
|
|
|
|
cmd('autocmd ' .. table.concat(autocmd, ' '))
|
|
|
|
end
|
|
|
|
cmd('augroup END')
|
|
|
|
end
|
|
|
|
|
2021-08-19 15:57:07 +02:00
|
|
|
local function dump(o)
|
|
|
|
if type(o) == 'table' then
|
|
|
|
local s = '{ '
|
|
|
|
for k,v in pairs(o) do
|
|
|
|
if type(k) ~= 'number' then k = '"'..k..'"' end
|
|
|
|
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
|
|
|
end
|
|
|
|
return s .. '} '
|
|
|
|
else
|
|
|
|
return tostring(o)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function M.has_plugin(pluginName)
|
2021-08-19 17:04:46 +02:00
|
|
|
local status = pcall(require, pluginName);
|
|
|
|
return status
|
2021-08-19 15:57:07 +02:00
|
|
|
end
|
|
|
|
|
2021-08-10 21:50:49 +02:00
|
|
|
return M
|