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

[Harpoon2]: Unable to select from list consistently #584

Open
Sergih28 opened this issue Apr 23, 2024 · 1 comment
Open

[Harpoon2]: Unable to select from list consistently #584

Sergih28 opened this issue Apr 23, 2024 · 1 comment

Comments

@Sergih28
Copy link

Sergih28 commented Apr 23, 2024

EDIT: I had a conflicting keybind. It works much more often now, but still not every time I open neovim.


The issue is that most of the times whenever I just quit and open neovim again in the same folder the keybinds for selecting from 1 to 4 on the list do not work. The keybinds for next and previous, as well as adding and showing the modal work always.

Just to clarify, by most of the times I mean that they work at least one, or a few times, until they stop working, and never work again. I did some "stress testing" opening and closing nvim to see if it was me messing it up not letting neovim to fully start before pressing harpoon keybinds, because when they work, they always do, but when I close and open again neovim, then it's highly likely they do not work anymore.

I haven't seen a clear pattern on why does this happen. Sometimes it shows on the bottom [LSP] No client with id x (x being usually a number from 1 to 3) which I have no idea what it is, and sometimes it doesn't show.

I suspected about some plugins that could be messing with harpoon, but I even uninstalled them to test and nothing changed (lspaga, auto-session and nvim-ufo) 🤔

Whenever it does not work on changing to the exact list file, it doesn't seem to be adding any line on the logs.
The way I checked the logs, which I'm not sure if it's the correct one, is with :lua require("harpoon").logger:show().
It does show some things when I change files with the previous and next shortcuts (which works fine always).


Some additional info about my config and versions:

I am using harpoon2 branch.

Neovim version is v0.9.5.

This is my config file based on the docs, with a slight modification on the keymaps.

Config
{
  "ThePrimeagen/harpoon",
  branch = "harpoon2",
  dependencies = { "nvim-lua/plenary.nvim" },
  config = function()
    local harpoon = require("harpoon")
    harpoon:setup()

    -- keybinds (they need to be here)
    vim.keymap.set("n", "<leader>a", function()
      harpoon:list():add()
    end)
    vim.keymap.set("n", "<leader><S-e>", function()
      harpoon.ui:toggle_quick_menu(harpoon:list())
    end)
    vim.keymap.set("n", "<C-h>", function()
      harpoon:list():select(1)
    end)
    vim.keymap.set("n", "<C-j>", function()
      harpoon:list():select(2)
    end)
    vim.keymap.set("n", "<C-k>", function()
      harpoon:list():select(3)
    end)
    vim.keymap.set("n", "<C-l>", function()
      harpoon:list():select(4)
    end)
    -- Toggle previous & next buffers stored within Harpoon list
    vim.keymap.set("n", "<C-p>", function()
      harpoon:list():prev()
    end)
    vim.keymap.set("n", "<C-n>", function()
      harpoon:list():next()
    end)
  end,
}

You can check my full neovim config here

@chenxin-yan
Copy link

I encountered the same issue and am trying to understand why it happened. I suspect that it might be caused by auto-session.

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

2 participants