2021-07-26 19:14:23 +02:00
|
|
|
local M = {}
|
|
|
|
|
2022-05-21 16:48:47 +02:00
|
|
|
vim.cmd [[
|
2021-07-26 19:14:23 +02:00
|
|
|
function! QuickFixToggle()
|
|
|
|
if empty(filter(getwininfo(), 'v:val.quickfix'))
|
|
|
|
copen
|
|
|
|
else
|
|
|
|
cclose
|
|
|
|
endif
|
|
|
|
endfunction
|
2022-05-21 16:48:47 +02:00
|
|
|
]]
|
|
|
|
|
|
|
|
M.defaults = {
|
|
|
|
{
|
|
|
|
name = "BufferKill",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.core.bufferline").buf_kill "bd"
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimToggleFormatOnSave",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.core.autocmds").toggle_format_on_save()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimInfo",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.core.info").toggle_popup(vim.bo.filetype)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimCacheReset",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.utils.hooks").reset_cache()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimReload",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.config"):reload()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimUpdate",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.bootstrap"):update()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimSyncCorePlugins",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.plugin-loader").sync_core_plugins()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimChangelog",
|
|
|
|
fn = function()
|
|
|
|
require("lvim.core.telescope.custom-finders").view_lunarvim_changelog()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LvimVersion",
|
|
|
|
fn = function()
|
|
|
|
print(require("lvim.utils.git").get_lvim_version())
|
|
|
|
end,
|
|
|
|
},
|
2021-07-26 19:14:23 +02:00
|
|
|
}
|
|
|
|
|
2022-05-21 16:48:47 +02:00
|
|
|
function M.load(collection)
|
|
|
|
local common_opts = { force = true }
|
|
|
|
for _, cmd in pairs(collection) do
|
|
|
|
local opts = vim.tbl_deep_extend("force", common_opts, cmd.opts or {})
|
|
|
|
vim.api.nvim_create_user_command(cmd.name, cmd.fn, opts)
|
2021-07-26 19:14:23 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|