arsham/yanker.nvim

Bug while trying to use yanker.nvim remap

Opened this issue ยท 13 comments

Description:

I am trying to import the yanker.nvim plugin. However, I am getting a bug when I try to run the keymap <leader>yh.

The plugin is imported as follows:

{ -- Imrpoved Yank
"arsham/yanker.nvim",
dependencies = { "arsham/arshlib.nvim", "junegunn/fzf.vim" },
-- config = true,
-- or to provide configurations
config = { history = "<leader>yh" },
},

When I run the keymap, I get the following error:

E5108: Error executing lua: Vim:E117: Unknown function: fzf#wrap
stack traceback:
        [C]: in function 'fzf#wrap'
        ...p/.local/share/nvim/lazy/yanker.nvim/lua/yanker/init.lua:68: in function <...p/.local/share/nvim/lazy/yanker.nvim/lua/yanker/init.lua:32>
Error: Couldn't load plugin: yanker.nvim

Additional Information:

  • My operating system is Ubuntu .
  • I am using NVIM v0.9.1.
  • I am using Lazy as a plugin manager
  • the dependencies plugins seems to be installed correctly. I run :Lazy and they show up.

Thank you for your help!

arsham commented

Hi, can you add junegunn/fzf to the list of dependencies please?

Hey Arsham, I am pretty sure I did it by:

dependencies = { "arsham/arshlib.nvim", "junegunn/fzf.vim" },

The full import of the plugin is in the issue description.

arsham commented

Sorry for not being clear. I meant adding a third dependency like so:

dependencies = { "arsham/arshlib.nvim", "junegunn/fzf.vim", "junegunn/fzf" },

Do you mean that when importing the plugin, put this block instead?

{ -- Imrpoved Yank
"arsham/yanker.nvim",
dependencies = { "arsham/arshlib.nvim", "junegunn/fzf.vim", "junegunn/fzf" },
-- config = true,
-- or to provide configurations
config = { history = "<leader>yh" },
},

@arsham, I wanted to let you know that your changes worked! However, I've encountered another issue.
If you wish, I will create a new pull request for this.

The issue is that the fzf screen now opens, but when I hover over the words in history and press "Enter," nothing happens. The yank register keeps the same value as before.

This is an image of the screen I see, I hover a word press enter, and nothing happens.

Screenshot from 2023-07-17 15-40-53

arsham commented

Glad it is setup. Yes, PR is always welcome!

Do you know why the issue happens? It doesn't save text into the register

arsham commented

I'm at work ATM, I will try to find the cause when I am finished today.

arsham commented

Sorry for the delay. I'm afraid I can't replicate it. Can you add a line (with vim.print) after this line of code to print the line and value please?

Thank you for your response.
Currently, I am using Lazy and my understanding is that it means I do not have the plugin source code on my system. Instead, it gets it from GitHub. In order to modify the code, I might need to set it up manually. However, I have no experience with this type of action, so it may take me some time to achieve it. I will keep you updated.
Thank you again for your assistance.

arsham commented

No worries. You should be able to set this up easily. Clone the repo to ~/Projects/arsham or any other folder (see ๐Ÿ‘‡) and setup
the lazy plugin manager like so:

require("lazy").setup("plugins", {
  root = vim.fn.stdpath("cache") .. "/lazy",
  dev = {
    path = "~/Projects/arsham", -- Whatever path you are going to use ๐Ÿ‘‡
  },
})
return {
  "arsham/yanker.nvim", -- rename it to the path you set ๐Ÿ‘†
  dev = true, -- <- important part
  name = "yanker.nvim",
  config = true,
  dependencies = {
    "arshlib.nvim",
    "junegunn/fzf",
    "junegunn/fzf.vim",
  },
  event = { "BufRead", "BufNewFile" },
}

It should use your local clone.

Hey @arsham,
I apologize it took me a long time to respond.
Thank you for explaining how to set the plugin locally.

I tried to add a print statement but nothing shows up. Here the code:

      wrapped["sink*"] = function(line)
        local type, value = string.gmatch(line[2], "%d+\t([^\t]+)\t.+\t(.+)$")()
        value = value:gsub("<CR>", "\n")
        print(value)
        print("test")
        vim.fn.setreg('"', value, type)
      end --}}}

It seems like the function doesn't being called as I don't see any output. (lazy uses for sure the local plugin as I added print statements at the top of the page and they it does work as expected)

arsham commented

Can you provide a minimal configuration so I can try to mimic what is happening on your setup please?