Skip to content

Commit

Permalink
feat(extras): added extra for mini.diff
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Mar 28, 2024
1 parent a786c47 commit e29c7ac
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
54 changes: 54 additions & 0 deletions lua/lazyvim/plugins/extras/editor/mini-diff.lua
Original file line number Diff line number Diff line change
@@ -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,
},
}
2 changes: 1 addition & 1 deletion lua/lazyvim/util/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e29c7ac

Please sign in to comment.