AckslD / nvim-neoclip.lua

Clipboard manager neovim plugin with telescope integration
944 stars 20 forks source link

Prompt Error #70

Open yyy33 opened 2 years ago

yyy33 commented 2 years ago

After starting nvim immediately after the execution of the command Telescope neoclip there is a certain chance that this error will be prompted, but not every time will be prompted, sometimes it is normal

Error executing Lua callback: ...er/start/telescope.nvim/lua/telescope/config/resolve.lua:142: attempt t
o compare number with nil
stack traceback:
        ...er/start/telescope.nvim/lua/telescope/config/resolve.lua:142: in function 'k'
        ...er/start/telescope.nvim/lua/telescope/config/resolve.lua:232: in function 'resolve_width'
        ...lescope.nvim/lua/telescope/pickers/layout_strategies.lua:310: in function 'get_window_options
'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:357: in function 'find'
        .../packer/start/nvim-neoclip.lua/lua/neoclip/telescope.lua:194: in function <.../packer/start/n
vim-neoclip.lua/lua/neoclip/telescope.lua:151>
        ...ck/packer/start/telescope.nvim/lua/telescope/command.lua:193: in function 'run_command'
        ...ck/packer/start/telescope.nvim/lua/telescope/command.lua:253: in function 'load_command'
        ...im/pack/packer/start/telescope.nvim/plugin/telescope.lua:109: in function <...im/pack/packer/
start/telescope.nvim/plugin/tel

This is my config

telescope


local ok, telescope = pcall(require, "telescope")
if not ok then
  return
end
local ok, actions = pcall(require, "telescope.actions")
if not ok then
  return
end

telescope.setup {
  defaults = {
      sorting_strategy = 'ascending',

      scroll_strategy = 'limit',

      layout_strategy = 'flex',
      layout_config = {
          height = {padding = 0},
          width = {padding = 0},
          prompt_position = "top",
          scroll_speed = 5,

          horizontal = {
              anchor = "CENTER",
              mirror = false, 
              preview_cutoff = 0,
              preview_width = 0.5,
          },

          vertical = {
              anchor = "CENTER",
              mirror = true, 
              preview_cutoff = 0,
              preview_height = 0.5,
          },
      },

      wrap_results = false,

      prompt_prefix = " ",

      selection_caret = " ",

      entry_prefix = '',

      path_display = {
          shorten = {
              len = 3, exclude = {1, -1}

neoclip

local ok, neoclip = pcall(require, "neoclip")
if not ok then
    return
end

neoclip.setup({
    history = 3333,
    enable_persistent_history = true,
    length_limit = 3145728,
    continuous_sync = false,
    db_path = vim.fn.stdpath("config") .. "/pack/packer/neoclip.sqlite3",
    filter = nil,
    preview = true,
    default_register = '+',
    default_register_macros = 'q',
    enable_macro_history = true,
    content_spec_column = true,
    on_paste = {
        set_reg = false,
    },
    on_replay = {
        set_reg = false,
    },
    keys = {
        telescope = {
            i = {
                --select = '<c-y>',
                --paste = '<c-p>',
                --paste_behind = '<c-P>',
                ---- replay a macro
                --replay = '<c-q>',
                ---- delete an entry
                --delete = '<c-d>',
                --custom = {},
            },
            n = {
                select = 'y',
                paste = 'p',
                paste_behind = 'P',
AckslD commented 2 years ago

Hi @yyy33! Are you lazy-loading telescope and/or neoclip and if so how?

yyy33 commented 2 years ago

Hi @yyy33! Are you lazy-loading telescope and/or neoclip and if so how?

Sorry for the problem with my system clipboard, here is my packer config file k.txt

yyy33 commented 2 years ago

Hi @yyy33! Are you lazy-loading telescope and/or neoclip and if so how?

I configured it according to your reademe documentation

yyy33 commented 2 years ago

Hi @yyy33! Are you lazy-loading telescope and/or neoclip and if so how? And if I add the line "module = 'sqlite'", my clipboard history will not be persisted, and the clipboard history will be empty after restarting nvim


use {
"kkharji/sqlite.lua",
disable = false,
module = 'sqlite',
}
AckslD commented 2 years ago

Looks like you're not lazy-loading? I do use module = 'sqlite' in my config which works well, see: https://gitlab.com/AckslD/config/-/blob/master/nvim/lua/plugins.lua#L323

Are your plugins up to date? Does this only happen with neoclip or also other telescope extensions?

yyy33 commented 2 years ago

Looks like you're not lazy-loading? I do use module = 'sqlite' in my config which works well, see: https://gitlab.com/AckslD/config/-/blob/master/nvim/lua/plugins.lua#L323

Are your plugins up to date? Does this only happen with neoclip or also other telescope extensions?

Now the error will not be reported, but I do not know what is the reason, in any case, has been modified to modify, but I guess the reason is packer, because I added the requirements sqlite , it does not automatically help me download. Then I encountered the reason why the clipboard could not be persistent, until I set the option continuous_sync = true, the clipboard can also be persistent, so I guess the vimleavepre event was not triggered. Then I now encounter the problem is that when I open nvim immediately after the exit, the next time I open nvim, the clipboard is empty

Translated with www.DeepL.com/Translator (free version)

yyy33 commented 2 years ago

Looks like you're not lazy-loading? I do use module = 'sqlite' in my config which works well, see: https://gitlab.com/AckslD/config/-/blob/master/nvim/lua/plugins.lua#L323

Are your plugins up to date? Does this only happen with neoclip or also other telescope extensions? Yes, I have the latest version of the plug-in

AckslD commented 2 years ago

Sorry, I'm not fully following, are things working now?

yyy33 commented 2 years ago

Sorry, I'm not fully following, are things working now?

Now there are two questions.

The problem occurs when the configuration option is below

    enable_persistent_history = true,
    continuous_sync = true,
  1. I use neovim to open a file at random, and do some copy and cut operations, and then exit
  2. I reopen neovim, check the clipboard history, see that they are saved correctly, and then I exit neovim
  3. I reopen neovim, then immediately press ZQ to exit,
  4. I reopen neovim, then check the clipboard history, they are empty

The problem occurs when the configuration option is below

    enable_persistent_history = true,
    continuous_sync = false,
  1. I open neovim and do some copy and cut operations, then check the clipboard history, they are successfully saved, then I exit neovim
  2. I reopen neovim and check the clipboard history, they are empty
AckslD commented 2 years ago

@yyy33 I'm afraid I cannot reproduce this. Maybe something else going on in your config? Could it be that you're lazy loading neoclip so if you just open neovim and close it directly it's never loaded?