feat: introduce status updates for Neovim Updater in lualine statusline
This commit is contained in:
+78
-15
@@ -550,10 +550,17 @@ M.group = {
|
||||
group = "MiniMap",
|
||||
icon = { icon = "", color = "green" },
|
||||
},
|
||||
nvimup = { -- Neovim Updater menu
|
||||
lhs = "<leader>qu",
|
||||
group = "Neovim Updater",
|
||||
icon = { icon = "", color = "red" },
|
||||
nvimup = {
|
||||
{ -- Neovim Updater menu
|
||||
lhs = "<leader>qu",
|
||||
group = "Neovim Updater",
|
||||
icon = { icon = "", color = "red" },
|
||||
},
|
||||
{ -- Neovim Updater Commits menu
|
||||
lhs = "<leader>quc",
|
||||
group = "New Commits",
|
||||
icon = { icon = "", color = "green" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -566,31 +573,52 @@ M.groups = {
|
||||
}
|
||||
|
||||
M.nvimup = {
|
||||
{
|
||||
{ -- Update Neovim from source
|
||||
"<Leader>quU",
|
||||
":UpdateNeovim<CR>",
|
||||
desc = "Update Neovim",
|
||||
},
|
||||
{
|
||||
{ -- Update Neovim from source in debug mode
|
||||
"<Leader>quD",
|
||||
function()
|
||||
require("nvim_updater").update_neovim({ build_type = "Debug" })
|
||||
end,
|
||||
desc = "Debug Build Neovim",
|
||||
},
|
||||
{
|
||||
{ -- Update Neovim from source in release mode
|
||||
"<Leader>quR",
|
||||
function()
|
||||
require("nvim_updater").update_neovim({ build_type = "Release" })
|
||||
end,
|
||||
desc = "Release Build Neovim",
|
||||
},
|
||||
{
|
||||
"<Leader>quC",
|
||||
{ -- Remove Neovim Source directory
|
||||
"<Leader>quX",
|
||||
function()
|
||||
require("nvim_updater").remove_source_dir()
|
||||
end,
|
||||
desc = "Clean Neovim Source",
|
||||
desc = "Remove Neovim Source",
|
||||
},
|
||||
{ -- Show new nvim source commits in Telescope
|
||||
"<Leader>quct",
|
||||
function()
|
||||
require("nvim_updater").show_new_commits_in_telescope()
|
||||
end,
|
||||
desc = "Show New Commits in Telescope",
|
||||
},
|
||||
{ -- Show new nvim source commits in DiffView
|
||||
"<Leader>qucd",
|
||||
function()
|
||||
require("nvim_updater").show_new_commits_in_diffview()
|
||||
end,
|
||||
desc = "Show New Commits in DiffView",
|
||||
},
|
||||
{ -- Show new nvim source commits in terminal
|
||||
"<Leader>qucc",
|
||||
function()
|
||||
require("nvim_updater").show_new_commits()
|
||||
end,
|
||||
desc = "Show New Commits in terminal",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -637,14 +665,14 @@ M.minifiles = {
|
||||
function()
|
||||
minifiles_toggle(vim.api.nvim_buf_get_name(0), true)
|
||||
end,
|
||||
desc = "Open mini.files (Directory of Current File)",
|
||||
desc = "Open mini.files",
|
||||
},
|
||||
{
|
||||
"<leader>fM",
|
||||
function()
|
||||
minifiles_toggle(vim.uv.cwd(), true)
|
||||
end,
|
||||
desc = "Open mini.files (cwd)",
|
||||
desc = "Open mini.files (CWD)",
|
||||
},
|
||||
{ -- Mini.files
|
||||
"<leader>.",
|
||||
@@ -653,6 +681,13 @@ M.minifiles = {
|
||||
end,
|
||||
desc = "Open mini.files",
|
||||
},
|
||||
{ -- Mini.files
|
||||
"<leader>sf",
|
||||
function()
|
||||
minifiles_toggle(vim.api.nvim_buf_get_name(0), true)
|
||||
end,
|
||||
desc = "Open mini.files",
|
||||
},
|
||||
}
|
||||
|
||||
--- Misc keymaps
|
||||
@@ -820,9 +855,19 @@ M.precog = {
|
||||
}
|
||||
|
||||
M.qalc = {
|
||||
{ -- Open Qalc
|
||||
-- { -- Open Qalc
|
||||
-- "<leader>qc",
|
||||
-- "<cmd>Qalc<cr>",
|
||||
-- desc = "Qalc",
|
||||
-- },
|
||||
{ -- Set a key mapping to run :Qalc and enter insert mode
|
||||
"<leader>qc",
|
||||
"<cmd>Qalc<cr>",
|
||||
function()
|
||||
-- Run the Qalc command
|
||||
vim.cmd("Qalc")
|
||||
-- Enter insert mode directly
|
||||
vim.cmd("startinsert")
|
||||
end,
|
||||
desc = "Qalc",
|
||||
},
|
||||
}
|
||||
@@ -992,7 +1037,7 @@ M.substitute = {
|
||||
M.overrides = {
|
||||
{ -- De-map 's' to avoid conflicts with mini.surround
|
||||
lhs = "s",
|
||||
rhs = "<Nop>",
|
||||
rhs = "<Nop>", -- This disables the keymap
|
||||
desc = "Surround",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
@@ -1048,6 +1093,24 @@ M.telescope = {
|
||||
mode = "n",
|
||||
},
|
||||
},
|
||||
filebrowser = {
|
||||
{
|
||||
"<leader>e",
|
||||
function()
|
||||
require("telescope").extensions.file_browser.file_browser()
|
||||
end,
|
||||
desc = "Telescope File Browser",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<leader>sF",
|
||||
function()
|
||||
require("telescope").extensions.file_browser.file_browser()
|
||||
end,
|
||||
desc = "Telescope File Browser",
|
||||
mode = "n",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.toggleterm = {
|
||||
|
||||
@@ -2,8 +2,12 @@ local data = require("data")
|
||||
|
||||
return { -- Neovim Updater
|
||||
"rootiest/nvim-updater.nvim",
|
||||
lazy = false,
|
||||
opts = {},
|
||||
opts = {
|
||||
verbose = true,
|
||||
check_for_updates = true,
|
||||
update_interval = (60 * 60) * 6, -- 6 hours
|
||||
default_keymaps = false,
|
||||
},
|
||||
keys = function()
|
||||
-- Add Neovim Updater menu
|
||||
data.func.add_keymap(data.keys.group.nvimup)
|
||||
|
||||
@@ -12,6 +12,48 @@ local music_stats = require("utils.music_stats")
|
||||
local data = require("data")
|
||||
local funcs = data.func
|
||||
|
||||
-- Setup NeoMiniMap extension
|
||||
-- local minimap_extension = require("neominimap.statusline").lualine_default
|
||||
local neominimap = require("neominimap.statusline")
|
||||
local minimap_extension = {
|
||||
sections = {
|
||||
lualine_a = {
|
||||
neominimap.plugin_name,
|
||||
},
|
||||
lualine_b = {
|
||||
{ -- Branch
|
||||
"branch",
|
||||
separator = "",
|
||||
padding = { left = 1, right = 0 },
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
neominimap.shortname,
|
||||
},
|
||||
lualine_y = {
|
||||
{ -- Progress
|
||||
"progress",
|
||||
separator = "",
|
||||
padding = { left = 0, right = 1 },
|
||||
icon = "",
|
||||
},
|
||||
neominimap.position,
|
||||
},
|
||||
lualine_z = {
|
||||
{ -- Time
|
||||
"datetime",
|
||||
style = "%a %R",
|
||||
icon = " ",
|
||||
padding = { left = 0, right = 1 },
|
||||
on_click = function()
|
||||
vim.cmd("Telescope oldfiles")
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = { "neominimap" },
|
||||
}
|
||||
|
||||
-- Use lualine by default
|
||||
if vim.g.statusline == nil then
|
||||
vim.g.statusline = "lualine"
|
||||
@@ -248,6 +290,18 @@ return { -- Lualine
|
||||
end,
|
||||
padding = { left = 0, right = 1 },
|
||||
},
|
||||
{ -- Neovim Updater Status
|
||||
function()
|
||||
return require("nvim_updater").get_statusline().icon_text
|
||||
end,
|
||||
color = function()
|
||||
return require("nvim_updater").get_statusline().color
|
||||
end,
|
||||
on_click = function()
|
||||
require("nvim_updater").show_new_commits(true)
|
||||
end,
|
||||
padding = { left = 1, right = 1 },
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{ -- NeoCodeium Status
|
||||
@@ -356,6 +410,7 @@ return { -- Lualine
|
||||
"quickfix",
|
||||
"symbols-outline",
|
||||
"trouble",
|
||||
minimap_extension,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user