♻️ refactor(git-plugins): create a git category and move relevant plugins there
Moved git plugins into their own category
This commit is contained in:
@@ -12,7 +12,13 @@ vim.g.loaded_perl_provider = 0
|
||||
vim.g.lazyvim_python_lsp = "basedpyright"
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Git-Blame ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.gitblame_display_virtual_text = 0 -- Disable virtual text
|
||||
-- vim.g.gitblame_display_virtual_text = 0 -- Disable virtual text
|
||||
-- vim.g.gitblame_date_format = "%r"
|
||||
-- vim.g.gitblame_message_when_not_committed = "Not yet committed!"
|
||||
-- vim.g.gitblame_message_template = "<author> • <date> • <summary> <<sha>>"
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ OS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ROOTIEST ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- stylua: ignore start
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Git Plugins │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
return {
|
||||
{ -- Git UI
|
||||
import = "lazyvim.plugins.extras.util.gitui",
|
||||
},
|
||||
{ -- Octo plugin
|
||||
import = "lazyvim.plugins.extras.util.octo",
|
||||
},
|
||||
{ -- Gist Tools
|
||||
"Rawnly/gist.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"GistCreate",
|
||||
"GistCreateFromFile",
|
||||
"GistsList",
|
||||
},
|
||||
keys = {
|
||||
{ -- Create Gist
|
||||
"<leader>gnc",
|
||||
"<cmd>GistCreate<cr>",
|
||||
desc = "Create Gist",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
{ -- Find Gists
|
||||
"<leader>gnf",
|
||||
"<cmd>GistList<cr>",
|
||||
desc = "Find Gists",
|
||||
},
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{ -- LazyGit
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
keys = {
|
||||
{ -- LazyGit
|
||||
"<leader>lg",
|
||||
"<cmd>LazyGit<cr>",
|
||||
desc = "LazyGit",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("lazygit")
|
||||
end,
|
||||
},
|
||||
{ -- Thanks/github-stars
|
||||
"jsongerber/thanks.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"ThanksAll",
|
||||
"ThanksGithubAuth",
|
||||
"ThanksGithubLogout",
|
||||
"ThanksClearCache",
|
||||
},
|
||||
opts = {
|
||||
star_on_install = false,
|
||||
},
|
||||
},
|
||||
{ -- GitLinker
|
||||
"linrongbin16/gitlinker.nvim",
|
||||
lazy = true,
|
||||
cmd = "GitLink",
|
||||
opts = {},
|
||||
keys = {
|
||||
{ -- Yank git link
|
||||
"<leader>gy",
|
||||
"<cmd>GitLink<cr>",
|
||||
mode = { "n", "v" },
|
||||
desc = "Yank git link",
|
||||
},
|
||||
{ -- Open git link
|
||||
"<leader>gY",
|
||||
"<cmd>GitLink!<cr>",
|
||||
mode = { "n", "v" },
|
||||
desc = "Open git link",
|
||||
},
|
||||
},
|
||||
},
|
||||
{ -- Git Blame
|
||||
"f-person/git-blame.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
-- Get the current lualine configuration
|
||||
local config = require("lualine").get_config()
|
||||
local git_blame = require("gitblame")
|
||||
local rootilities = require("utils.rootiest")
|
||||
-- Define the width limit for displaying the Git blame component
|
||||
local width_limit = 180 -- Adjust this value as needed
|
||||
-- Add Git-blame to lualine_c section
|
||||
table.insert(config.sections.lualine_c, {
|
||||
git_blame.get_current_blame_text,
|
||||
cond = function() -- Only show the component if the text is available
|
||||
return git_blame.is_blame_text_available()
|
||||
and rootilities.is_window_wide_enough(width_limit)
|
||||
end,
|
||||
color = { fg = rootilities.get_fg_color("GitSignsCurrentLineBlame") },
|
||||
})
|
||||
-- Apply the lualine configuration
|
||||
require("lualine").setup(config)
|
||||
-- Define git-blame options
|
||||
local git_ops = {
|
||||
display_virtual_text = 0, -- Disable virtual text
|
||||
date_format = "%r", -- Relative date format
|
||||
message_when_not_committed = " Fly, you fools!",
|
||||
message_template = "<author> • <date> • <summary>",
|
||||
}
|
||||
-- Return the git-blame options
|
||||
return git_ops
|
||||
end,
|
||||
},
|
||||
{ -- Git Graph
|
||||
"isakbm/gitgraph.nvim",
|
||||
opts = {
|
||||
symbols = {
|
||||
merge_commit = "",
|
||||
commit = "",
|
||||
merge_commit_end = "",
|
||||
commit_end = "",
|
||||
|
||||
-- Advanced symbols
|
||||
GVER = "",
|
||||
GHOR = "",
|
||||
GCLD = "",
|
||||
GCRD = "╭",
|
||||
GCLU = "",
|
||||
GCRU = "",
|
||||
GLRU = "",
|
||||
GLRD = "",
|
||||
GLUD = "",
|
||||
GRUD = "",
|
||||
GFORKU = "",
|
||||
GFORKD = "",
|
||||
GRUDCD = "",
|
||||
GRUDCU = "",
|
||||
GLUDCD = "",
|
||||
GLUDCU = "",
|
||||
GLRDCL = "",
|
||||
GLRDCR = "",
|
||||
GLRUCL = "",
|
||||
GLRUCR = "",
|
||||
},
|
||||
format = {
|
||||
timestamp = "%H:%M:%S %d-%m-%Y",
|
||||
fields = { "hash", "timestamp", "author", "branch_name", "tag" },
|
||||
},
|
||||
hooks = {
|
||||
on_select_commit = function(commit)
|
||||
print("selected commit:", commit.hash)
|
||||
end,
|
||||
on_select_range_commit = function(from, to)
|
||||
print("selected range:", from.hash, to.hash)
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ -- gitgraph_toggle
|
||||
"<leader>gm",
|
||||
function()
|
||||
require("utils.git").gitgraph_toggle()
|
||||
end,
|
||||
desc = "GitGraph - Toggle",
|
||||
},
|
||||
},
|
||||
},
|
||||
{ -- FuGit
|
||||
"SuperBo/fugit2.nvim",
|
||||
opts = {
|
||||
width = 100,
|
||||
},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"chrisgrieser/nvim-tinygit", -- optional: for Github PR view
|
||||
dependencies = { "stevearc/dressing.nvim" },
|
||||
},
|
||||
},
|
||||
cmd = {
|
||||
"Fugit2",
|
||||
"Fugit2Diff",
|
||||
"Fugit2Graph",
|
||||
},
|
||||
keys = {
|
||||
{ -- Open Fugit
|
||||
"<leader>F",
|
||||
mode = "n",
|
||||
"<cmd>Fugit2<cr>",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
+11
-113
@@ -2,8 +2,6 @@
|
||||
-- │ Utilities │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
local rootilities = require("utils.rootilities")
|
||||
|
||||
return {
|
||||
{ -- Chezmoi
|
||||
import = "lazyvim.plugins.extras.util.chezmoi",
|
||||
@@ -11,12 +9,6 @@ return {
|
||||
{ -- Dotfiles plugins
|
||||
import = "lazyvim.plugins.extras.util.dot",
|
||||
},
|
||||
{ -- Git UI
|
||||
import = "lazyvim.plugins.extras.util.gitui",
|
||||
},
|
||||
{ -- Octo plugin
|
||||
import = "lazyvim.plugins.extras.util.octo",
|
||||
},
|
||||
{ -- Wakatime
|
||||
"wakatime/vim-wakatime",
|
||||
cond = vim.g.usewakatime,
|
||||
@@ -64,29 +56,6 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{ -- Gist Tools
|
||||
"Rawnly/gist.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"GistCreate",
|
||||
"GistCreateFromFile",
|
||||
"GistsList",
|
||||
},
|
||||
keys = {
|
||||
{ -- Create Gist
|
||||
"<leader>gnc",
|
||||
"<cmd>GistCreate<cr>",
|
||||
desc = "Create Gist",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
{ -- Find Gists
|
||||
"<leader>gnf",
|
||||
"<cmd>GistList<cr>",
|
||||
desc = "Find Gists",
|
||||
},
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{ -- Unception
|
||||
"samjwill/nvim-unception",
|
||||
init = function()
|
||||
@@ -118,31 +87,6 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{ -- LazyGit
|
||||
"kdheepak/lazygit.nvim",
|
||||
event = "VeryLazy",
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
keys = {
|
||||
{ -- LazyGit
|
||||
"<leader>lg",
|
||||
"<cmd>LazyGit<cr>",
|
||||
desc = "LazyGit",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("lazygit")
|
||||
end,
|
||||
},
|
||||
{ -- Codesnap
|
||||
"mistricky/codesnap.nvim",
|
||||
lazy = true,
|
||||
@@ -196,19 +140,6 @@ return {
|
||||
require("kulala").setup()
|
||||
end,
|
||||
},
|
||||
{ -- Thanks/github-stars
|
||||
"jsongerber/thanks.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"ThanksAll",
|
||||
"ThanksGithubAuth",
|
||||
"ThanksGithubLogout",
|
||||
"ThanksClearCache",
|
||||
},
|
||||
opts = {
|
||||
star_on_install = false,
|
||||
},
|
||||
},
|
||||
{ -- Hardtime
|
||||
"m4xshen/hardtime.nvim",
|
||||
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
|
||||
@@ -216,26 +147,6 @@ return {
|
||||
return { enabled = vim.g.usehardtime }
|
||||
end,
|
||||
},
|
||||
{ -- GitLinker
|
||||
"linrongbin16/gitlinker.nvim",
|
||||
lazy = true,
|
||||
cmd = "GitLink",
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"<leader>gy",
|
||||
"<cmd>GitLink<cr>",
|
||||
mode = { "n", "v" },
|
||||
desc = "Yank git link",
|
||||
},
|
||||
{
|
||||
"<leader>gY",
|
||||
"<cmd>GitLink!<cr>",
|
||||
mode = { "n", "v" },
|
||||
desc = "Open git link",
|
||||
},
|
||||
},
|
||||
},
|
||||
{ -- CapsWord
|
||||
"dmtrKovalenko/caps-word.nvim",
|
||||
lazy = true,
|
||||
@@ -258,30 +169,6 @@ return {
|
||||
default_player = "YoutubeMusic",
|
||||
},
|
||||
},
|
||||
{ -- Git Blame
|
||||
"f-person/git-blame.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
-- Get the current lualine configuration
|
||||
local config = require("lualine").get_config()
|
||||
local git_blame = require("gitblame")
|
||||
-- Define the width limit for displaying the Git blame component
|
||||
local width_limit = 180 -- Adjust this value as needed
|
||||
|
||||
-- Add Git-blame to lualine_c section
|
||||
table.insert(config.sections.lualine_c, {
|
||||
git_blame.get_current_blame_text,
|
||||
cond = function()
|
||||
return git_blame.is_blame_text_available()
|
||||
and rootilities.is_window_wide_enough(width_limit)
|
||||
end,
|
||||
color = { fg = rootilities.get_fg_color("GitSignsCurrentLineBlame") },
|
||||
})
|
||||
|
||||
-- Apply the new configuration
|
||||
require("lualine").setup(config)
|
||||
end,
|
||||
},
|
||||
{ -- Qalc
|
||||
"Apeiros-46B/qalc.nvim",
|
||||
cmd = {
|
||||
@@ -307,4 +194,15 @@ return {
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{ -- Encourage
|
||||
"r-cha/encourage.nvim",
|
||||
config = true,
|
||||
},
|
||||
{ -- Helpview
|
||||
"OXY2DEV/helpview.nvim",
|
||||
ft = "help",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
local M = {}
|
||||
|
||||
function M.gitgraph_draw()
|
||||
-- open gitgraph in a seperate tab
|
||||
if vim.bo.filetype == "gitgraph" then
|
||||
return
|
||||
end
|
||||
vim.cmd("tab split")
|
||||
require("gitgraph").draw({}, { all = true, max_count = 5000 })
|
||||
end
|
||||
|
||||
function M.gitgraph_close()
|
||||
--- close the tab page if it is a gitgraph page
|
||||
if vim.bo.filetype == "gitgraph" then
|
||||
vim.cmd("tabclose")
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function M.gitgraph_toggle()
|
||||
-- toggle gitgraph
|
||||
if vim.bo.filetype == "gitgraph" then
|
||||
M.gitgraph_close()
|
||||
else
|
||||
M.gitgraph_draw()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user