feat: enable clickable git components in statusline
This commit is contained in:
@@ -165,7 +165,7 @@ vim.g.statusline = "lualine" ---@type string Options: [status
|
|||||||
-- ╰───────────────────────────╯
|
-- ╰───────────────────────────╯
|
||||||
|
|
||||||
-- Click git components on statusline to open LazyGit
|
-- Click git components on statusline to open LazyGit
|
||||||
vim.g.statusline_clickable_git = false ---@type boolean Options: <true|false>
|
vim.g.statusline_clickable_git = true ---@type boolean Options: <true|false>
|
||||||
-- Show wakatime stats on statusline
|
-- Show wakatime stats on statusline
|
||||||
vim.g.stats_wakatime = true ---@type boolean Options: <true|false>
|
vim.g.stats_wakatime = true ---@type boolean Options: <true|false>
|
||||||
-- Show music stats on statusline
|
-- Show music stats on statusline
|
||||||
|
|||||||
@@ -84,6 +84,16 @@ local function get_neocodeium_status(ev)
|
|||||||
vim.api.nvim_buf_set_var(ev.buf, 'neocodeium_status', luacodeium)
|
vim.api.nvim_buf_set_var(ev.buf, 'neocodeium_status', luacodeium)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function open_git_diff()
|
||||||
|
if vim.g.statusline_clickable_git ~= false then
|
||||||
|
if pcall(require, 'diffview') then
|
||||||
|
require('diffview').open({})
|
||||||
|
else
|
||||||
|
Snacks.lazygit()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Then only some of event fired we invoked this function
|
-- Then only some of event fired we invoked this function
|
||||||
vim.api.nvim_create_autocmd('User', {
|
vim.api.nvim_create_autocmd('User', {
|
||||||
group = ..., -- set some augroup here
|
group = ..., -- set some augroup here
|
||||||
@@ -280,9 +290,7 @@ return { -- Lualine
|
|||||||
removed = icons.git.removed,
|
removed = icons.git.removed,
|
||||||
padding = { left = 0, right = 0 },
|
padding = { left = 0, right = 0 },
|
||||||
on_click = function()
|
on_click = function()
|
||||||
if vim.g.statusline_clickable_git ~= false then
|
open_git_diff()
|
||||||
require('config.rootiest').toggle_lazygit_float()
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ -- GitSigns
|
{ -- GitSigns
|
||||||
@@ -302,7 +310,7 @@ return { -- Lualine
|
|||||||
padding = { left = 0, right = 0 },
|
padding = { left = 0, right = 0 },
|
||||||
on_click = function()
|
on_click = function()
|
||||||
if vim.g.statusline_clickable_git ~= false then
|
if vim.g.statusline_clickable_git ~= false then
|
||||||
require('config.rootiest').toggle_lazygit_float()
|
Snacks.lazygit()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@@ -355,6 +363,12 @@ return { -- Lualine
|
|||||||
function()
|
function()
|
||||||
return vim.b.neocodeium_status or ' '
|
return vim.b.neocodeium_status or ' '
|
||||||
end,
|
end,
|
||||||
|
cond = function()
|
||||||
|
if not pcall(require, 'neocodeium') then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
padding = { left = 0, right = 1 },
|
padding = { left = 0, right = 1 },
|
||||||
},
|
},
|
||||||
{ -- Wordcount
|
{ -- Wordcount
|
||||||
@@ -426,7 +440,10 @@ return { -- Lualine
|
|||||||
{ -- Recording
|
{ -- Recording
|
||||||
require('recorder').recordingStatus,
|
require('recorder').recordingStatus,
|
||||||
cond = function()
|
cond = function()
|
||||||
return pcall(require, 'recorder')
|
if not pcall(require, 'recorder') then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
end,
|
end,
|
||||||
color = 'CurSearch',
|
color = 'CurSearch',
|
||||||
separator = { left = '', right = '' },
|
separator = { left = '', right = '' },
|
||||||
|
|||||||
Reference in New Issue
Block a user