mikesmithgh / git-prompt-string-lualine.nvim

📍Add git-prompt-string to your Neovim statusline!
Apache License 2.0
22 stars 1 forks source link

feat: extend user patterns for autocmd #7

Open timeitel opened 1 month ago

timeitel commented 1 month ago

Hi, thanks for this plugin. Can the events be extended to also include the ones from Neogit? It would also be helpful to expose a refresh function if possible for user maps.

mikesmithgh commented 3 weeks ago

Hey @timeitel thanks for the PR

It would also be helpful to expose a refresh function if possible for user maps.

You can refresh like this 🙂

require('git-prompt-string-lualine').set_prompt_and_refresh()

Can the events be extended to also include the ones from Neogit?

I am not opposed to adding them. I am just curious if they are actually needed. git-prompt-string-lualine has a filewatch https://github.com/mikesmithgh/git-prompt-string-lualine.nvim/blob/main/lua/git-prompt-string-lualine/autocmd.lua#L35 and I would expect that to trigger a refresh on any git pull/push/commit regardless of how it occurred. Are you not seeing updates when you do a Neogit operation?

timeitel commented 3 weeks ago

Hey @timeitel thanks for the PR

It would also be helpful to expose a refresh function if possible for user maps.

You can refresh like this 🙂

require('git-prompt-string-lualine').set_prompt_and_refresh()

Can the events be extended to also include the ones from Neogit?

I am not opposed to adding them. I am just curious if they are actually needed. git-prompt-string-lualine has a filewatch https://github.com/mikesmithgh/git-prompt-string-lualine.nvim/blob/main/lua/git-prompt-string-lualine/autocmd.lua#L35 and I would expect that to trigger a refresh on any git pull/push/commit regardless of how it occurred. Are you not seeing updates when you do a Neogit operation?

Thanks for mentioning the refresh and adding more events! From testing I just realised the git operations aren't triggering any refresh when the working directory is a git worktree. Possibly because FileChangedShellPost won't be triggered from commits since the .git folder is outside the CWD?

mikesmithgh commented 3 weeks ago

Thanks for mentioning the refresh and adding more events! From testing I just realised the git operations aren't triggering any refresh when the working directory is a git worktree. Possibly because FileChangedShellPost won't be triggered from commits since the .git folder is outside the CWD?

Could you provide an example of the directory structure or steps to reproduce?

timeitel commented 2 days ago

Thanks for mentioning the refresh and adding more events! From testing I just realised the git operations aren't triggering any refresh when the working directory is a git worktree. Possibly because FileChangedShellPost won't be triggered from commits since the .git folder is outside the CWD?

Could you provide an example of the directory structure or steps to reproduce?

I realised it's not working for bare repos, just fyi