feat(extras): added extra for mini.diff
This commit is contained in:
4
NEWS.md
4
NEWS.md
@ -2,6 +2,10 @@
|
||||
|
||||
## 10.x
|
||||
|
||||
- added new extra for [mini.diff](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md)
|
||||
This is a plugin similar to gitsigns but with a neat diff overlay
|
||||
that can be toggled with `<leader>go`.
|
||||
|
||||
- **trouble.nvim** has been rewritten from scratch and is now in beta.
|
||||
I've added a new extra for it (`trouble-v3`) for those of you who want to try it out.
|
||||
You can find the updated docs [here](https://github.com/folke/trouble.nvim/tree/dev)
|
||||
|
54
lua/lazyvim/plugins/extras/editor/mini-diff.lua
Normal file
54
lua/lazyvim/plugins/extras/editor/mini-diff.lua
Normal file
@ -0,0 +1,54 @@
|
||||
return {
|
||||
-- disable gitsigns.nvim
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
enabled = false,
|
||||
},
|
||||
|
||||
-- setup mini.diff
|
||||
{
|
||||
"echasnovski/mini.diff",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{
|
||||
"<leader>go",
|
||||
function()
|
||||
require("mini.diff").toggle_overlay(0)
|
||||
end,
|
||||
desc = "Toggle mini.diff overlay",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
view = {
|
||||
style = "sign",
|
||||
signs = {
|
||||
add = "▎",
|
||||
change = "▎",
|
||||
delete = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- lualine integration
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = function(_, opts)
|
||||
local x = opts.sections.lualine_x
|
||||
for _, comp in ipairs(x) do
|
||||
if comp[1] == "diff" then
|
||||
comp.source = function()
|
||||
local summary = vim.b.minidiff_summary
|
||||
return summary
|
||||
and {
|
||||
added = summary.add,
|
||||
modified = summary.change,
|
||||
removed = summary.delete,
|
||||
}
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
@ -103,7 +103,7 @@ function M.statuscolumn()
|
||||
---@type Sign?,Sign?,Sign?
|
||||
local left, right, fold
|
||||
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
|
||||
if s.name and s.name:find("GitSign") then
|
||||
if s.name and (s.name:find("GitSign") or s.name:find("MiniDiffSign")) then
|
||||
right = s
|
||||
else
|
||||
left = s
|
||||
|
Reference in New Issue
Block a user