mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
revert: do not run packer.sync() on every reload (#2548)
* revert: do not run packer.sync() on every reload * chore: update which-key mappings for logs
This commit is contained in:
parent
d0c5393543
commit
a68c1cfbf5
4 changed files with 24 additions and 6 deletions
|
@ -108,6 +108,7 @@ M.toggle_log_view = function(logfile)
|
||||||
if vim.fn.executable(log_viewer) ~= 1 then
|
if vim.fn.executable(log_viewer) ~= 1 then
|
||||||
log_viewer = "less +F"
|
log_viewer = "less +F"
|
||||||
end
|
end
|
||||||
|
Log:debug("attempting to open: " .. logfile)
|
||||||
log_viewer = log_viewer .. " " .. logfile
|
log_viewer = log_viewer .. " " .. logfile
|
||||||
local term_opts = vim.tbl_deep_extend("force", lvim.builtin.terminal, {
|
local term_opts = vim.tbl_deep_extend("force", lvim.builtin.terminal, {
|
||||||
cmd = log_viewer,
|
cmd = log_viewer,
|
||||||
|
|
|
@ -214,10 +214,10 @@ M.config = function()
|
||||||
},
|
},
|
||||||
N = { "<cmd>edit $NVIM_LOG_FILE<cr>", "Open the Neovim logfile" },
|
N = { "<cmd>edit $NVIM_LOG_FILE<cr>", "Open the Neovim logfile" },
|
||||||
p = {
|
p = {
|
||||||
"<cmd>lua require('lvim.core.terminal').toggle_log_view('packer.nvim')<cr>",
|
"<cmd>lua require('lvim.core.terminal').toggle_log_view(get_cache_dir() .. '/packer.nvim.log')<cr>",
|
||||||
"view packer log",
|
"view packer log",
|
||||||
},
|
},
|
||||||
P = { "<cmd>exe 'edit '.stdpath('cache').'/packer.nvim.log'<cr>", "Open the Packer logfile" },
|
P = { "<cmd>edit $LUNARVIM_CACHE_DIR/packer.nvim.log<cr>", "Open the Packer logfile" },
|
||||||
},
|
},
|
||||||
r = { "<cmd>LvimReload<cr>", "Reload LunarVim's configuration" },
|
r = { "<cmd>LvimReload<cr>", "Reload LunarVim's configuration" },
|
||||||
u = { "<cmd>LvimUpdate<cr>", "Update LunarVim" },
|
u = { "<cmd>LvimUpdate<cr>", "Update LunarVim" },
|
||||||
|
|
|
@ -35,7 +35,7 @@ function plugin_loader.init(opts)
|
||||||
init_opts.display = nil
|
init_opts.display = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
if not utils.is_directory(install_path) then
|
||||||
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
||||||
vim.cmd "packadd packer.nvim"
|
vim.cmd "packadd packer.nvim"
|
||||||
-- IMPORTANT: we only set this the very first time to avoid constantly triggering the rollback function
|
-- IMPORTANT: we only set this the very first time to avoid constantly triggering the rollback function
|
||||||
|
@ -86,7 +86,7 @@ function plugin_loader.reload(configurations)
|
||||||
end
|
end
|
||||||
plugin_loader.load(configurations)
|
plugin_loader.load(configurations)
|
||||||
|
|
||||||
pcall_packer_command "sync"
|
plugin_loader.ensure_plugins()
|
||||||
end
|
end
|
||||||
|
|
||||||
function plugin_loader.load(configurations)
|
function plugin_loader.load(configurations)
|
||||||
|
@ -140,8 +140,25 @@ function plugin_loader.sync_core_plugins()
|
||||||
-- problem: rollback() will get stuck if a plugin directory doesn't exist
|
-- problem: rollback() will get stuck if a plugin directory doesn't exist
|
||||||
-- solution: call sync() beforehand
|
-- solution: call sync() beforehand
|
||||||
-- see https://github.com/wbthomason/packer.nvim/issues/862
|
-- see https://github.com/wbthomason/packer.nvim/issues/862
|
||||||
vim.cmd [[autocmd User PackerComplete ++once lua require("lvim.plugin-loader").load_snapshot() ]]
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "PackerComplete",
|
||||||
|
once = true,
|
||||||
|
callback = require("lvim.plugin-loader").load_snapshot,
|
||||||
|
})
|
||||||
pcall_packer_command "sync"
|
pcall_packer_command "sync"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function plugin_loader.ensure_plugins()
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "PackerComplete",
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
Log:debug "calling packer.clean()"
|
||||||
|
pcall_packer_command "clean"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
Log:debug "calling packer.install()"
|
||||||
|
pcall_packer_command "install"
|
||||||
|
end
|
||||||
|
|
||||||
return plugin_loader
|
return plugin_loader
|
||||||
|
|
|
@ -13,7 +13,7 @@ end
|
||||||
|
|
||||||
function M.run_on_packer_complete()
|
function M.run_on_packer_complete()
|
||||||
Log:debug "Packer operation complete"
|
Log:debug "Packer operation complete"
|
||||||
vim.cmd [[doautocmd User PackerComplete]]
|
vim.api.nvim_exec_autocmds("User", { pattern = "PackerComplete" })
|
||||||
|
|
||||||
vim.g.colors_name = lvim.colorscheme
|
vim.g.colors_name = lvim.colorscheme
|
||||||
pcall(vim.cmd, "colorscheme " .. lvim.colorscheme)
|
pcall(vim.cmd, "colorscheme " .. lvim.colorscheme)
|
||||||
|
|
Loading…
Reference in a new issue