gbprod / yanky.nvim

Improved Yank and Put functionalities for Neovim
Do What The F*ck You Want To Public License
802 stars 22 forks source link

Error executing lua callback attempt to index field 'yanky_textobj' (a nil value) #148

Closed pchampio closed 8 months ago

pchampio commented 9 months ago

Sometime, I'm getting this error on each key press in insert mode:

Error executing lua callback: .../.local/share/nvim/lazy/yanky.nvim/lua/yanky/textobj.lua:39: attempt to index field 'yanky_textobj' (a nil value)                                              
stack traceback:                                                                                                                                                                                
        .../.local/share/nvim/lazy/yanky.nvim/lua/yanky/textobj.lua:39: in function <.../.local/share/nvim/lazy/yanky.nvim/lua/yanky/textobj.lua:37> 

nvim

NVIM v0.9.2
Build type: Release
LuaJIT 2.1.1692716794

         fichier vimrc système : "$VIM/sysinit.vim"
               $VIM par défaut : "
/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

conf

  {
    "gbprod/yanky.nvim",
    config = function ()
    vim.cmd([[hi YankyPut guifg=#37afd3 gui=underline,bold]])
    local mapping = require "yanky.telescope.mapping"
    local mappings = mapping.get_defaults()
    mappings.i["<c-p>"] = nil
    mappings.i["<cr>"] = mapping.set_register(require("yanky.utils").get_default_register())
    require("yanky").setup({
      system_clipboard={sync_with_ring=false},
        picker = {
          telescope = {
            use_default_mappings = false,
            mappings = mappings,
          },
        },
        highlight = {
          on_put = true,
          on_yank = false,
          timer = 500,
        },
    })
    vim.keymap.set({"n","x"}, "y", "<Plug>(YankyYank)")
    vim.keymap.set("n", "[y", "<Plug>(YankyCycleForward)")
    vim.keymap.set("n", "]y", "<Plug>(YankyCycleBackward)")
    vim.api.nvim_set_keymap("", "p", "<Plug>(YankyPutAfter)", { desc = "Paste after" })
    vim.api.nvim_set_keymap("", "P", "<Plug>(YankyPutBefore)", { desc = "Paste before" })
    vim.api.nvim_set_keymap("", "gp", "<Plug>(YankyPutIndentAfterLinewise)", { desc = "Paste G after" })
    vim.api.nvim_set_keymap("", "gP", "<Plug>(YankyPutIndentBeforeLinewise)", { desc = "Paste G before" })
    require("telescope").load_extension("yank_history")
    vim.api.nvim_set_keymap("", "<leader>yy", ":Telescope yank_history<cr>", { desc = "Open Yank History",  noremap = true, silent = true })
  end,
},
gbprod commented 9 months ago

Are you sure to have the latest yanky version installed ? Can you update your plugins add tell me if you still have this issue ?

gbprod commented 8 months ago

Feel free to re-open if the issue comes back