Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitstatus: also colorize other projects #327

Open
cisoun opened this issue Oct 25, 2023 · 2 comments
Open

gitstatus: also colorize other projects #327

cisoun opened this issue Oct 25, 2023 · 2 comments

Comments

@cisoun
Copy link
Contributor

cisoun commented Oct 25, 2023

Hello,

I'm trying to make gitstatus colorize other projects than the first one.
For instance, here, only the first project "www" is colorized but not the ones below it (triage/chronos):

image

I can try to implement that but I'm not sure how the projects are handled at app and treeview level. Would someone be able to do that or explain what I would need to do to make it work?

Thank you.

@Guldoman
Copy link
Member

I think you could just iterate over core.project_directories here:

local folder = core.project_dir
for line in string.gmatch(diff, "[^\n]+") do
local submodule = line:match("^Entering '(.+)'$")
if submodule then
folder = core.project_dir .. PATHSEP .. submodule
else
local ins, dels, path = line:match("(%d+)%s+(%d+)%s+(.+)")
if path then
inserts = inserts + (tonumber(ins) or 0)
deletes = deletes + (tonumber(dels) or 0)
local abs_path = folder .. PATHSEP .. path
-- Color this file, and each parent folder,
-- so you can see at a glance which folders
-- have modified files in them.
while abs_path do
cached_color_for_item[abs_path] = style.gitstatus_modification
abs_path = common.dirname(abs_path)
end
end
end
end

I don't think you'd need to change anything else.

@cisoun
Copy link
Contributor Author

cisoun commented Oct 25, 2023

Ah well seen... I'm not familiar (yet) with all the core functions. Seems good, I'll experiment. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants