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",
|
group = "MiniMap",
|
||||||
icon = { icon = "", color = "green" },
|
icon = { icon = "", color = "green" },
|
||||||
},
|
},
|
||||||
nvimup = { -- Neovim Updater menu
|
nvimup = {
|
||||||
lhs = "<leader>qu",
|
{ -- Neovim Updater menu
|
||||||
group = "Neovim Updater",
|
lhs = "<leader>qu",
|
||||||
icon = { icon = "", color = "red" },
|
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 = {
|
M.nvimup = {
|
||||||
{
|
{ -- Update Neovim from source
|
||||||
"<Leader>quU",
|
"<Leader>quU",
|
||||||
":UpdateNeovim<CR>",
|
":UpdateNeovim<CR>",
|
||||||
desc = "Update Neovim",
|
desc = "Update Neovim",
|
||||||
},
|
},
|
||||||
{
|
{ -- Update Neovim from source in debug mode
|
||||||
"<Leader>quD",
|
"<Leader>quD",
|
||||||
function()
|
function()
|
||||||
require("nvim_updater").update_neovim({ build_type = "Debug" })
|
require("nvim_updater").update_neovim({ build_type = "Debug" })
|
||||||
end,
|
end,
|
||||||
desc = "Debug Build Neovim",
|
desc = "Debug Build Neovim",
|
||||||
},
|
},
|
||||||
{
|
{ -- Update Neovim from source in release mode
|
||||||
"<Leader>quR",
|
"<Leader>quR",
|
||||||
function()
|
function()
|
||||||
require("nvim_updater").update_neovim({ build_type = "Release" })
|
require("nvim_updater").update_neovim({ build_type = "Release" })
|
||||||
end,
|
end,
|
||||||
desc = "Release Build Neovim",
|
desc = "Release Build Neovim",
|
||||||
},
|
},
|
||||||
{
|
{ -- Remove Neovim Source directory
|
||||||
"<Leader>quC",
|
"<Leader>quX",
|
||||||
function()
|
function()
|
||||||
require("nvim_updater").remove_source_dir()
|
require("nvim_updater").remove_source_dir()
|
||||||
end,
|
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()
|
function()
|
||||||
minifiles_toggle(vim.api.nvim_buf_get_name(0), true)
|
minifiles_toggle(vim.api.nvim_buf_get_name(0), true)
|
||||||
end,
|
end,
|
||||||
desc = "Open mini.files (Directory of Current File)",
|
desc = "Open mini.files",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fM",
|
"<leader>fM",
|
||||||
function()
|
function()
|
||||||
minifiles_toggle(vim.uv.cwd(), true)
|
minifiles_toggle(vim.uv.cwd(), true)
|
||||||
end,
|
end,
|
||||||
desc = "Open mini.files (cwd)",
|
desc = "Open mini.files (CWD)",
|
||||||
},
|
},
|
||||||
{ -- Mini.files
|
{ -- Mini.files
|
||||||
"<leader>.",
|
"<leader>.",
|
||||||
@@ -653,6 +681,13 @@ M.minifiles = {
|
|||||||
end,
|
end,
|
||||||
desc = "Open mini.files",
|
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
|
--- Misc keymaps
|
||||||
@@ -820,9 +855,19 @@ M.precog = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
M.qalc = {
|
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",
|
"<leader>qc",
|
||||||
"<cmd>Qalc<cr>",
|
function()
|
||||||
|
-- Run the Qalc command
|
||||||
|
vim.cmd("Qalc")
|
||||||
|
-- Enter insert mode directly
|
||||||
|
vim.cmd("startinsert")
|
||||||
|
end,
|
||||||
desc = "Qalc",
|
desc = "Qalc",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -992,7 +1037,7 @@ M.substitute = {
|
|||||||
M.overrides = {
|
M.overrides = {
|
||||||
{ -- De-map 's' to avoid conflicts with mini.surround
|
{ -- De-map 's' to avoid conflicts with mini.surround
|
||||||
lhs = "s",
|
lhs = "s",
|
||||||
rhs = "<Nop>",
|
rhs = "<Nop>", -- This disables the keymap
|
||||||
desc = "Surround",
|
desc = "Surround",
|
||||||
mode = { "n", "x" },
|
mode = { "n", "x" },
|
||||||
},
|
},
|
||||||
@@ -1048,6 +1093,24 @@ M.telescope = {
|
|||||||
mode = "n",
|
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 = {
|
M.toggleterm = {
|
||||||
|
|||||||
@@ -2,8 +2,12 @@ local data = require("data")
|
|||||||
|
|
||||||
return { -- Neovim Updater
|
return { -- Neovim Updater
|
||||||
"rootiest/nvim-updater.nvim",
|
"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()
|
keys = function()
|
||||||
-- Add Neovim Updater menu
|
-- Add Neovim Updater menu
|
||||||
data.func.add_keymap(data.keys.group.nvimup)
|
data.func.add_keymap(data.keys.group.nvimup)
|
||||||
|
|||||||
@@ -12,6 +12,48 @@ local music_stats = require("utils.music_stats")
|
|||||||
local data = require("data")
|
local data = require("data")
|
||||||
local funcs = data.func
|
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
|
-- Use lualine by default
|
||||||
if vim.g.statusline == nil then
|
if vim.g.statusline == nil then
|
||||||
vim.g.statusline = "lualine"
|
vim.g.statusline = "lualine"
|
||||||
@@ -248,6 +290,18 @@ return { -- Lualine
|
|||||||
end,
|
end,
|
||||||
padding = { left = 0, right = 1 },
|
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 = {
|
lualine_y = {
|
||||||
{ -- NeoCodeium Status
|
{ -- NeoCodeium Status
|
||||||
@@ -356,6 +410,7 @@ return { -- Lualine
|
|||||||
"quickfix",
|
"quickfix",
|
||||||
"symbols-outline",
|
"symbols-outline",
|
||||||
"trouble",
|
"trouble",
|
||||||
|
minimap_extension,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user