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

git submodule icons in nvim-tree #3038

Open
adimail opened this issue Dec 23, 2024 · 2 comments
Open

git submodule icons in nvim-tree #3038

adimail opened this issue Dec 23, 2024 · 2 comments

Comments

@adimail
Copy link

adimail commented Dec 23, 2024

It would be helpful to have a dedicated icon for Git submodules in the nvim-tree file explorer. Currently, while nvim-tree supports various Git status icons (e.g., staged, unstaged, untracked), there isn’t an option to display a unique icon for submodules.

This would improve the visual distinction of submodule folders and make it easier for users to identify them in the tree view.

Proposed Solution

Allow users to define a custom icon for Git submodules in the renderer.icons.git configuration. For example:

renderer = {
    -- other configurations...
    icons = {
        -- other icons...
        git = {
            -- existing git icons...
            submodule = '',  -- Git submodule icon
        },
    },
},

References

This feature idea was originally discussed here: Does nvim-tree have webicon for git submodules?.

Request

I’d appreciate guidance on how to proceed with implementing this feature.

@alex-courtis alex-courtis transferred this issue from nvim-tree/nvim-web-devicons Dec 28, 2024
@alex-courtis
Copy link
Member

I see, the request is for the module directory itself, rather than the module file.

I've moved this issue from web-devicons to nvim-tree itself and closed the other issue, to keep discussion in one place.

This is possible, but a non-trivial amount of work:

  • nvim-tree is aware of multiple git repos in the tree, however a submodule is just another repo.
  • We'd need to add submodule awareness to lua/nvim-tree/git/init.lua and cache it GitProject
  • We can't simply query at display time, as that is a very expensive operation.

I'm very open to pull requests, as this would be a useful feature, see CONTRIBUTING.md

@Pistonight
Copy link

Hi, long time user of nvim-tree here and I am looking forward to this feature! However, git performance is already not ideal especially for large repos so it would be nice that this doesn't regress the existing git integrations. My idea is that all submodules paths can be listed once with git submodule status --recursive and that can be cached, then it could be refreshed whenever .gitmodules changes - so basically never unless a submodule is added or removed

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

3 participants