ekickx / clipboard-image.nvim

Neovim Lua plugin to paste image from clipboard.
MIT License
313 stars 51 forks source link

Checkhealth not working #52

Open Fireond opened 1 year ago

Fireond commented 1 year ago

I use lazy.nvim to install the plugin, the setup is

{
    "ekickx/clipboard-image.nvim",
    opts = { -- Default configuration for all filetype
      default = {
        img_dir = { "%:p:h", "img" },
        img_name = function()
          local name = os.date("%y-%m-%d-%H-%M-%S")

          vim.ui.input({ prompt = "Name: ", default = name }, function(input)
            name = input
          end)
          return name
        end,
        affix = "<\n  %s\n>", -- Multi lines affix
      },
      -- You can create configuration for ceartain filetype by creating another field (markdown, in this case)
      -- If you're uncertain what to name your field to, you can run `lua print(vim.bo.filetype)`
      -- Missing options from `markdown` field will be replaced by options from `default` field
      markdown = {
        img_dir = { "src", "assets", "img" }, -- Use table for nested dir (New feature form PR #20)
        img_dir_txt = "/assets/img",
        img_handler = function(img) -- New feature from PR #22
          local script = string.format('./image_compressor.sh "%s"', img.path)
          os.execute(script)
        end,
      },
    },
    ft = { "tex", "markdown" },
    keys = {
      { "<leader>i", "<cmd>PasteImg<cr>", desc = "Paste image" },
    },
  }

which just copy the example settings and add ft and keys for lazy.nvim. When I run checkhealth cliclipboard-image it output:

==============================================================================
clipboard-image: require("clipboard-image.health").check()

- ERROR Failed to run healthcheck for "clipboard-image" plugin. Exception:
  function health#check, line 25
  Vim(eval):E5108: Error executing lua ...lazy/clipboard-image.nvim/lua/clipboard-image/health.lua:3: module 'health' not found:
  no field package.preload['health']
  cache_loader: module health not found
  cache_loader_lib: module health not found
  no file './health.lua'
  no file '/opt/homebrew/share/luajit-2.1.0-beta3/health.lua'
  no file '/usr/local/share/lua/5.1/health.lua'
  no file '/usr/local/share/lua/5.1/health/init.lua'
  no file '/opt/homebrew/share/lua/5.1/health.lua'
  no file '/opt/homebrew/share/lua/5.1/health/init.lua'
  no file './health.so'
  no file '/usr/local/lib/lua/5.1/health.so'
  no file '/opt/homebrew/lib/lua/5.1/health.so'
  no file '/usr/local/lib/lua/5.1/loadall.so'
  stack traceback:
  [C]: in function 'require'
  ...lazy/clipboard-image.nvim/lua/clipboard-image/health.lua:3: in main chunk
  [C]: in function 'require'
  [string "luaeval()"]:1: in main chunk

Other plugin's checkhealth can run correctly. And also when I run PasteImg it has error

E5108: Error executing lua [string ":lua"]:1: loop or previous error loading module 'clipboard-image.paste'
stack traceback:
    [C]: in function 'require'
    [string ":lua"]:1: in main chunk

Can you help me? Thanks

jamezwhocares commented 1 year ago

Already discussed in https://github.com/ekickx/clipboard-image.nvim/issues/50

dfendr commented 1 year ago

Here's a temporary fix until the plugin is updated