jackielii / neo-tree-harpoon.nvim

Show Harpoon buffers in a neo-tree panel
The Unlicense
8 stars 0 forks source link

Not loading #1

Closed baroldgene closed 2 months ago

baroldgene commented 2 months ago

This plugin looks amazing! Sadly I can't seem to get it to load at all. I'm not sure what I'm doing wrong.

Here is my neo-tree.lua file:

return {
  "nvim-neo-tree/neo-tree.nvim",
  opts = {
    sources = { "filesystem", "buffers", "git_status", "harpoon-buffers", "document_symbols", },
    source_selector = {
      winbar = true,
    },
    filesystem = {
      bind_to_cwd = true,
      components = {
        harpoon_index = function(config, node, _)
          local harpoon_list = require("harpoon"):list()
          local path = node:get_id()
          local harpoon_key = vim.uv.cwd()

          for i, item in ipairs(harpoon_list.items) do
            local value = item.value
            if string.sub(item.value, 1, 1) ~= "/" then
              value = harpoon_key .. "/" .. item.value
            end

            if value == path then
              vim.print(path)
              return {
                text = string.format(" ⥤ %d", i), 
                highlight = config.highlight or "NeoTreeDirectoryIcon",
              }
            end
          end
          return {}
        end,
      },
      renderers = {
        file = {
          { "icon" },
          { "name",         use_git_status_colors = true },
          { "harpoon_index" }, --> This is what actually adds the component in where you want it
          { "diagnostics" },
          { "git_status", highlight = "NeoTreeDimText" },
        },
      },
    },
  },
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
    "jackielii/neo-tree-harpoon.nvim",
    "MunifTanjim/nui.nvim",
    "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
    "MunifTanjim/nui.nvim",
  },
}

And I've also added the following edgy.lua file:

return {
  "folke/edgy.nvim",
  opts = {
    keys = {
    },
    left = {
      {
        title = "Harpoon Buffers",
        ft = "neo-tree",
        filter = function(buf)
          return vim.b[buf].neo_tree_source == "harpoon-buffers"
        end,
        pinned = true,
        open = "Neotree position=top harpoon-buffers",
        size = { height = 0.2 },
      },

    }
  }
}

Apologies if I'm doing something stupid. I'm relatively new to nvim.

jackielii commented 2 months ago

can you try run :Neotree harpoon-buffers to see if the panel opens?

baroldgene commented 2 months ago

It did show up when I did that. I think the problem was with Edgy.

I ended up just doing this in my neo-tree.lua file:


return {
  "nvim-neo-tree/neo-tree.nvim",
  opts = {
    sources = { "filesystem", "buffers", "git_status", "harpoon-buffers", "document_symbols", },
    source_selector = {
      winbar = true,
      sources = {
        { source = "filesystem",      display_name = "Files" },
        { source = "harpoon-buffers", display_name = "Harpoon" },
        { source = "buffers",         display_name = "Open" },
        { source = "git_status",      display_name = "Git" },
      }
    },
  ......
}

'''

This just adds harpoon buffers as a tab in a winbar on top of my neo-tree which I kinda prefer anyway.
jackielii commented 2 months ago

cool