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

attempt to get length of fi eld 'YANKY_HISTORY' (a nil value) #1

Closed
vsedov opened this issue Mar 23, 2022 · 4 comments
Closed

attempt to get length of fi eld 'YANKY_HISTORY' (a nil value) #1

vsedov opened this issue Mar 23, 2022 · 4 comments

Comments

@vsedov
Copy link

vsedov commented Mar 23, 2022

E5108: Error executing lua ...e/pack/packer/opt/yanky.nvim/lua/yanky/storage/shada.lua:23: attempt to get length of fi
eld 'YANKY_HISTORY' (a nil value)                                                                                     
stack traceback:                                                                                                      
        ...e/pack/packer/opt/yanky.nvim/lua/yanky/storage/shada.lua:23: in function 'length'                          
        ...im/site/pack/packer/opt/yanky.nvim/lua/yanky/history.lua:38: in function 'first'                           
        ...share/nvim/site/pack/packer/opt/yanky.nvim/lua/yanky.lua:87: in function 'put'                             
        [string ":lua"]:1: in main chunk

setup

    keys = {
        "<C-v>",
        "<Plug>(YankyPutAfter)",
        "<Plug>(YankyPutBefore)",
        "<Plug>(YankyPutAfter)",
        "<Plug>(YankyPutBefore)",

        "<Plug>(YankyGPutAfter)",
        "<Plug>(YankyGPutBefore)",
        "<Plug>(YankyGPutAfter)",
        "<Plug>(YankyGPutBefore)",

        "<Plug>(YankyCycleForward)",
        "<Plug>(YankyCycleBackward)",
    },
    setup = function()
        local default_keymaps = {
            { "n", "p", "<Plug>(YankyPutAfter)" },
            { "n", "P", "<Plug>(YankyPutBefore)" },

            { "x", "p", "<Plug>(YankyPutAfter)" },
            { "x", "P", "<Plug>(YankyPutBefore)" },

            { "n", "<leader>p", "<Plug>(YankyGPutAfter)" },
            { "n", "<leader>P", "<Plug>(YankyGPutBefore)" },

            { "x", "<leader>p", "<Plug>(YankyGPutAfter)" },
            { "x", "<leader>P", "<Plug>(YankyGPutBefore)" },

            { "n", "<Leader>n", "<Plug>(YankyCycleForward)" },
            { "n", "<Leader>N", "<Plug>(YankyCycleBackward)" },
        }
        for _, m in ipairs(default_keymaps) do
            vim.keymap.set(m[1], m[2], m[3], {})
        end
    end,
    config = function()
        require("yanky").setup({
            ring = {
                history_length = 10,
                storage = "shada",
            },
        })
    end,
@gbprod
Copy link
Owner

gbprod commented Mar 23, 2022

Hi and thanks for the feedback. I'll take a look at this as soon as possible.

gbprod added a commit that referenced this issue Mar 24, 2022
@gbprod
Copy link
Owner

gbprod commented Mar 24, 2022

Made a fix, could you update and confirm that's ok ?

FYI : This plugin is under development and at a really early stage, I'm working on really hard to have something really cool. So : expects bug, feel free to send feedbacks and thanks for trying this :)

@vsedov
Copy link
Author

vsedov commented Mar 24, 2022

Yeah this been a great plugin, and very much looking forward to see what is to come .

Still getting the error it seems. even with min config

Error detected while processing TextYankPost Autocommands for "*":                                           
E5108: Error executing lua .../site/pack/packer/start/yanky.nvim/lua/yanky/history.lua:15: attempt to index field 'sto
rage' (a nil value)
stack traceback:
        .../site/pack/packer/start/yanky.nvim/lua/yanky/history.lua:15: in function 'push'
        /tmp/nvim/site/pack/packer/start/yanky.nvim/lua/yanky.lua:151: in function 'on_yank'
        [string ":lua"]:1: in main chunk```

min config

vim.cmd([[set runtimepath=$VIMRUNTIME]])

vim.cmd([[set packpath=/tmp/nvim/site]])
vim.cmd([[set clipboard = "unnamedplus"]])
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            "akinsho/bufferline.nvim",
            {
                "nvim-telescope/telescope.nvim",
                requires = {
                    "nvim-lua/plenary.nvim",
                },
            },
            {
                "gbprod/yanky.nvim",
            },
        },
        config = {
            package_root = package_root,
            compile_path = install_path .. "/plugin/packer_compiled.lua",
            display = { non_interactive = true },
        },
    })
end                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                
_G.load_config = function()                                                                                                                                                                                                                     
            require("yanky").setup({                                                                                                                                                                                                            
            ring = {                                                                                                                                                                                                                            
                history_length = 10,                                                                                                                                                                                                            
                storage = "shada",                                                                                                                                                                                                              
            },                                                                                                                                                                                                                                  
        })                                                                                                                                                                                                                                      
    require("bufferline").setup({                                                                                                                                                                                                               
        options = {                                                                                                                                                                                                                             
            mode = "buffers",                                                                                                                                                                                                                   
            diagnostics = "nvim_diagnostic",                                                                                                                                                                                                    
            always_show_bufferline = false,                                                                                                                                                                                                     
        },                                                                                                                                                                                                                                      
    })                                                                                                                                                                                                                                          
end                                                                                                                                                                                                                                             
-- if vim.fn.isdirectory(install_path) == 0 then                                                                                                                                                                                                
print("Installing Telescope and dependencies.")                                                                                                                                                                                                 
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })                                                                                                                                       
-- end                                                                                                                                                                                                                                          
load_plugins()                                                                                                                                                                                                                                  
require("packer").sync()                                                                                                                                                                                                                        
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]])                                                                                                                                                               
~
~
~```
When i try yy or dd or any sort of yank command you get this error :)

@gbprod
Copy link
Owner

gbprod commented Mar 24, 2022

It should works now
Thanks !

@gbprod gbprod closed this as completed Mar 25, 2022
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