refactor(nvim): use Lazy package manager instead of packer

This commit is contained in:
Price Hiller 2022-12-20 22:30:10 -06:00
parent e6d158f54e
commit 485c8024f6
5 changed files with 795 additions and 831 deletions

View File

@ -1,5 +1 @@
local loaded, impatient = pcall(require, 'impatient')
if loaded then
impatient.enable_profile()
end
require('main')

View File

@ -29,20 +29,18 @@ local header = {
}
-- Subheader, plugin count
local get_plugins = function()
local num_plugins_loaded = #vim.fn.globpath(vim.fn.stdpath('data') .. '/site/pack/packer/start', '*', 0, 1)
local num_plugins_total = #vim.tbl_keys(packer_plugins)
if num_plugins_total <= 1 then
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugin  loaded'
local get_plugin_info = function()
if require("lazy.status").has_updates() then
return "Plugin updates available, check :Lazy"
else
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugins  loaded'
return "All plugins up to date"
end
end
local plugin_count = {
local plugin_info = {
type = 'text',
val = {
get_plugins(),
get_plugin_info()
},
opts = {
hl = 'Comment',
@ -87,7 +85,7 @@ local buttons = {
button('f', ' Find File', ':Telescope find_files<CR>'),
button('r', ' Recent', ':Telescope oldfiles<CR>'),
button('s', ' Settings', ':e ~/.config/nvim/<CR>'),
button('u', ' Update Plugins', ':PackerSync<CR>'),
button('u', ' Update Plugins', ':Lazy sync<CR>'),
button('q', ' Quit', ':qa<CR>'),
},
opts = {
@ -113,7 +111,7 @@ local opts = {
padding(),
header,
padding(),
plugin_count,
plugin_info,
padding(),
buttons,
padding(),

View File

@ -130,7 +130,12 @@ lualine.setup({
},
-- Right
lualine_x = {},
lualine_x = {
{
require("lazy.status").updates,
cond = require("lazy.status").has_updates,
},
},
lualine_y = {
{
"buffers",

View File

@ -183,34 +183,6 @@ vim.keymap.set(
{ silent = true, desc = "Gitsigns: Unstage Hunk" }
)
-- Packer Mappings
local packer = require("packer")
local packer_sync = function()
vim.notify("Syncing packer.", "info", {
title = "Packer",
})
local snap_shot_time = tostring(os.date("!%Y-%m-%dT%TZ"))
packer.snapshot(snap_shot_time)
packer.sync()
end
local packer_compile = function()
vim.notify("Compiling packer.", "info", {
title = "Packer",
})
packer.compile()
end
vim.keymap.set("n", "<leader>ps", packer_sync, {
silent = true,
desc = "Packer: Sync",
})
vim.keymap.set("n", "<leader>pc", packer_compile, {
silent = true,
desc = "Packer: Compile",
})
-- Hop Mappings
local hop = require("hop")

File diff suppressed because it is too large Load Diff