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

Builtin switch hook throws error #24

Open
luqasz opened this issue Aug 5, 2024 · 3 comments
Open

Builtin switch hook throws error #24

luqasz opened this issue Aug 5, 2024 · 3 comments

Comments

@luqasz
Copy link

luqasz commented Aug 5, 2024

Error executing vim.schedule lua callback: .../paqs/start/git-worktree.nvim/lua/git-worktree/hooks.lua:91: attempt to call field 'get' (a nil value)
stack traceback:
        .../paqs/start/git-worktree.nvim/lua/git-worktree/hooks.lua:91: in function 'hook'
        .../paqs/start/git-worktree.nvim/lua/git-worktree/hooks.lua:43: in function 'emit'
        ...qs/start/git-worktree.nvim/lua/git-worktree/worktree.lua:74: in function <...qs/start/git-worktree.nvim/lua/git-worktree/worktree.lua:72>

This is what I get with registered hook update_current_buffer_on_switch. Lualine branch name isn't updated as well. Probably I'll need to write my own hook for that ?

@elsesiy
Copy link

elsesiy commented Aug 7, 2024

My fix for this was merged yesterday but is still pending a release it seems. @polarmutex when do you plan on cutting a new release?

@Antony-AXS
Copy link

Antony-AXS commented Aug 8, 2024

Error executing vim.schedule lua callback: .../paqs/start/git-worktree.nvim/lua/git-worktree/hooks.lua:91: attempt to call field 'get' (a nil value)
stack traceback:
        .../paqs/start/git-worktree.nvim/lua/git-worktree/hooks.lua:91: in function 'hook'
        .../paqs/start/git-worktree.nvim/lua/git-worktree/hooks.lua:43: in function 'emit'
        ...qs/start/git-worktree.nvim/lua/git-worktree/worktree.lua:74: in function <...qs/start/git-worktree.nvim/lua/git-worktree/worktree.lua:72>

This is what I get with registered hook update_current_buffer_on_switch. Lualine branch name isn't updated as well. Probably I'll need to write my own hook for that ?

I'm really new to this, what are hooks by the way?
nothing in much of it in explain in the README , please do let me know

@gKits
Copy link

gKits commented Aug 26, 2024

@Antony-AXS A hook is basically a function that is executed when a certain event is triggered. Currently you can register a hook on the events CREATE, DELETE and SWITCH (see here).

This way you can program custom behavior to integrate the git worktree workflow into your current dev environment. Here is an example out of my own config where I integrated the switch behavior for the oil.nvim file explorer.

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

4 participants