Add "pre-event" hooks#1917
Conversation
|
That's about what I had in mind too. I would, though, create a "hook.lua" file with a The second arg can be an optional table of arguments to pass into the hook function. |
4de8583 to
503f93c
Compare
|
Changes since last push:
|
503f93c to
05307b1
Compare
|
I implemented the remaining events as hooks. The commits can be squashed later. I assumed separate commits would be easier to review. |
7cd2303 to
774ffb6
Compare
774ffb6 to
7390e7d
Compare
|
I wasn't certain about where to call some hooks. Some calls can be moved a few lines while others can be moved to different functions. |
ceb559c to
1b82ecc
Compare
|
I've updated the PR with documentation. |
b310c20 to
adab5b1
Compare
e248100 to
f5b32b1
Compare
|
Hi! I apologize for taking so long to sort out the merge conflict. I've updated the branch to fix those conflicts, but also removed the commits for the remaining events. This should make reviewing easier for you. Sorry for going overboard. I made a branch on my fork with those commits if you wish to revisit them ( |
This is a POC for hooks as requested in #1909. This PR will remain a draft during the iteration and planning phase. Once an approach is agreed upon, then this PR will be cleaned up to be a candidate for merging.
I am not fluent in lua, so please be critical with coding standards.
Testing done:
I've run this locally on my own config to solve the problem from the aforementioned issue. I added the following to my neogit config:
The function body can be replaced with
print("Running PreBranchCheckout")for a simple verification.Neovim versions tested on:
OSes tests on:
Remaining work:
PreStatusRefreshedPreCommitCompletePrePushCompletePrePullCompletePreFetchCompletePreBranchCreatePreBranchDeletePreBranchCheckoustate:open tPreBranchResetPreBranchRenamePreRebasePreResetPreTagCreatePreTagDeletePreCherryPickPreMergePreStashRefsRefreshedDiffLoadedBisectWorktreeCreate