nvim: after/plugin/mini: Switch to mini.diff from gitsigns

This commit is contained in:
Sanchayan Maity 2024-03-31 16:29:21 +05:30
parent 81aeeb634f
commit 703d23c76e
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3
2 changed files with 25 additions and 8 deletions

View file

@ -3,6 +3,22 @@ local opts = { noremap=true, silent=true, unique=true }
-- Comment lines
require('mini.comment').setup()
-- Diff hunks
require('mini.diff').setup({
view = {
style = 'sign',
signs = { add = '+', change = '~', delete = '-' },
},
mappings = {
textobject = 'gh',
goto_prev = '[c',
goto_next = ']c',
goto_first = '<Leader>hf',
goto_last = '<Leader>hl',
apply = '<Leader>hs',
reset = '<Leader>hr',
},
})
-- File System
require('mini.files').setup({
mappings = {

View file

@ -136,19 +136,18 @@ M.get_git_branch = function(self)
end
M.get_git_status = function(self)
local signs = vim.b.gitsigns_status_dict
or { head = "", added = 0, changed = 0, removed = 0 }
local is_head_empty = signs.head ~= ""
local is_git = fn.FugitiveHead() ~= ""
local signs = vim.b.minidiff_summary or { add = 0, change = 0, delete = 0 }
return is_head_empty
return is_git
and string.format(
" %s+%s %s~%s %s-%s",
"%#DiffAdded#",
signs.added or 0,
signs.add,
"%#DiffChanged#",
signs.changed or 0,
signs.change,
"%#DiffRemoved#",
signs.removed or 0
signs.delete
)
or ""
end
@ -204,8 +203,10 @@ M.progress = function()
end
M.git_ahead_behind_status = function()
local is_git = fn.FugitiveHead() ~= ""
return
vim.b.gitsigns_status_dict
is_git
and
string.format(" %s%s%d%s%d", '%#GitStatus#', '', gstatus.behind, '', gstatus.ahead)
or ""