Closed linrongbin16 closed 8 months ago
You can check the implementation of those components here: https://github.com/MunifTanjim/nougat.nvim/tree/main/lua/nougat/nut/git
For adding new provider for git branch, we'll need to update this: https://github.com/MunifTanjim/nougat.nvim/blob/700708b73c037e7800cbb27209247fdd1b6a122f/lua/nougat/nut/git/branch.lua#L12-L19
For adding new provider for git status, we'll need to update here: https://github.com/MunifTanjim/nougat.nvim/blob/700708b73c037e7800cbb27209247fdd1b6a122f/lua/nougat/cache/buffer.lua#L125-L160
I think I can have a try to make a PR for this
hi @MunifTanjim , I found in cache/buffer.lua:
It's using on_event
to listen gitsigns git changes, but vim-gitgutter seems doesn't emit any events when the git changes happen.
on_event("User GitSignsUpdate", function(params)
Is there any other way to trigger cache refresh? maybe a timer scheduled per second?
You can probably use this event: https://github.com/airblade/vim-gitgutter/blob/4b49965897b8264cd6f90fa47ddb917f4296c469/doc/gitgutter.txt#L244C1-L252 ?
So it'll be like:
on_event("User GitGutter", function(params)
local bufnr = vim.g.gitgutter_hook_context.bufnr
local data = vim.fn.GitGutterGetHunkSummary()
local added, changed, removed = data[1], data[2], data[3]
end)
The 'git-branch' is very easy to implement as an 'Item', I think it's cool to leave it to user to define by themselves.
Did you check the docs and existing issues?
Problem
I'm using vim-gitbranch as git branch data source, and vim-gitgutter as git diff/status data source.
I know most people are using gitsigns, but it has some small bugs on Windows, gitgutter has much better cross-platform compatibilities.
For now I'm configure it with:
It is working, looks like:
But I want to enable the
green
,yellow
,red
colors for theadded
,changed
andremoved
lines count number.How should I do it?
I am using the slanty.lua template, the git status sample is:
It seems the
content
innut.git.status.count
is not overwrite-able, correct?Solution
Use self-defined data source for git status.
Alternatives
No response
Additional Context
No response