Skip to content

feat: extend user patterns for autocmd #7

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

timeitel
Copy link

@timeitel timeitel commented Oct 19, 2024

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.

@timeitel timeitel requested a review from mikesmithgh as a code owner October 19, 2024 08:27
@mikesmithgh
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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

@mikesmithgh
Copy link
Owner

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

@timeitel Thanks for the info. Yep, git-prompt-string should just detect a bare repo but can't perform the same as if it was in a working tree. The branch would just look something like BARE:main. Is that the issue you were seeing, or is there some other workflow you have? (I may be missing something if you have a different workflow than me)

@timeitel
Copy link
Author

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

@timeitel Thanks for the info. Yep, git-prompt-string should just detect a bare repo but can't perform the same as if it was in a working tree. The branch would just look something like BARE:main. Is that the issue you were seeing, or is there some other workflow you have? (I may be missing something if you have a different workflow than me)

Sorry I should say, the issue is specifically when using a git worktree. For example, create a worktree, make any git change like commit or push with the neovim terminal, and there's no update in git-prompt-string until refocusing the application.

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

Successfully merging this pull request may close these issues.

2 participants