polarmutex / git-worktree.nvim

MIT License
46 stars 12 forks source link

Unable to get this working with LazyNvim #21

Open riza-khan opened 1 month ago

riza-khan commented 1 month ago

Just switched to Lazyvim and can't seem to get this plugin to work as expected. Worked great on Astronvim just fine.

This is the setup:

  {
    'polarmutex/git-worktree.nvim',
    version = '^2',
    dependencies = { "nvim-lua/plenary.nvim" },
    enabled = true,
    config = function ()
      require('telescope').load_extension('git_worktree')

      vim.keymap.set( "n", "W", function ()
        require("telescope").extensions.git_worktree.git_worktrees()
      end, { desc = "Worktrees" })
  end
},

Throws this:

E5108: Error executing lua: /Users/[user]/.config/nvim/lua/plugins/core.lua:52: attempt to call field 'git_worktrees' (a nil value) stack traceback: /Users/[user]/.config/nvim/lua/plugins/core.lua:52: in function </Users/[user]/.config/nvim/lua/plugins/core.lua:51>

Any thoughts on how to get it working with Lazyvim?

PhilVoel commented 1 month ago

The function in the keymap should be require("telescope").extensions.git_worktree.git_worktree() ("worktree" without the "s")

riza-khan commented 1 month ago

Ah it looks like there was a verbiage change in V2. Thank you.

This may warrant its own issue but now there list of worktrees is not complete and I get this warning:

[telescope] [WARN 17:23:06] /Users/[user]/.local/share/nvim/lazy/telescope.nvim/lua/telescope/pickers.lua:677: Finder failed with msg: ...lazy/telescope.nvim/lua/telescope/pickers/highlights.lua:33: Invalid 'hl_group': Expected Lua string