refactor(nvim): use Lazy package manager instead of packer
This commit is contained in:
parent
e6d158f54e
commit
485c8024f6
@ -1,5 +1 @@
|
|||||||
local loaded, impatient = pcall(require, 'impatient')
|
|
||||||
if loaded then
|
|
||||||
impatient.enable_profile()
|
|
||||||
end
|
|
||||||
require('main')
|
require('main')
|
||||||
|
@ -29,20 +29,18 @@ local header = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Subheader, plugin count
|
-- Subheader, plugin count
|
||||||
local get_plugins = function()
|
local get_plugin_info = function()
|
||||||
local num_plugins_loaded = #vim.fn.globpath(vim.fn.stdpath('data') .. '/site/pack/packer/start', '*', 0, 1)
|
if require("lazy.status").has_updates() then
|
||||||
local num_plugins_total = #vim.tbl_keys(packer_plugins)
|
return "Plugin updates available, check :Lazy"
|
||||||
if num_plugins_total <= 1 then
|
|
||||||
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugin loaded'
|
|
||||||
else
|
else
|
||||||
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugins loaded'
|
return "All plugins up to date"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local plugin_count = {
|
local plugin_info = {
|
||||||
type = 'text',
|
type = 'text',
|
||||||
val = {
|
val = {
|
||||||
get_plugins(),
|
get_plugin_info()
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
hl = 'Comment',
|
hl = 'Comment',
|
||||||
@ -87,7 +85,7 @@ local buttons = {
|
|||||||
button('f', ' Find File', ':Telescope find_files<CR>'),
|
button('f', ' Find File', ':Telescope find_files<CR>'),
|
||||||
button('r', ' Recent', ':Telescope oldfiles<CR>'),
|
button('r', ' Recent', ':Telescope oldfiles<CR>'),
|
||||||
button('s', ' Settings', ':e ~/.config/nvim/<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>'),
|
button('q', ' Quit', ':qa<CR>'),
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
@ -113,7 +111,7 @@ local opts = {
|
|||||||
padding(),
|
padding(),
|
||||||
header,
|
header,
|
||||||
padding(),
|
padding(),
|
||||||
plugin_count,
|
plugin_info,
|
||||||
padding(),
|
padding(),
|
||||||
buttons,
|
buttons,
|
||||||
padding(),
|
padding(),
|
||||||
|
@ -130,7 +130,12 @@ lualine.setup({
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- Right
|
-- Right
|
||||||
lualine_x = {},
|
lualine_x = {
|
||||||
|
{
|
||||||
|
require("lazy.status").updates,
|
||||||
|
cond = require("lazy.status").has_updates,
|
||||||
|
},
|
||||||
|
},
|
||||||
lualine_y = {
|
lualine_y = {
|
||||||
{
|
{
|
||||||
"buffers",
|
"buffers",
|
||||||
|
@ -183,34 +183,6 @@ vim.keymap.set(
|
|||||||
{ silent = true, desc = "Gitsigns: Unstage Hunk" }
|
{ 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
|
-- Hop Mappings
|
||||||
local hop = require("hop")
|
local hop = require("hop")
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user