ekickx / clipboard-image.nvim

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

The options can be function or string #4

Closed ekickx closed 3 years ago

ekickx commented 3 years ago

I want the option to not only be function, but also string. So the config can be like this:

require'clipboard-image'.setup {
  img_dir = 'src/assets/img',
  img_dir_txt =  '/assets/img',
  img_name = function ()
    local img_dir = require'clipboard-image'.get_config().img_dir()
    local index = 1
    for output in io.popen('ls '..img_dir):lines() do
      if output == 'image'..index..'.png' then
        index = index + 1
      else
        break
      end
    end
    return 'image'..index
  end,
  prefix = '![](',
  suffix = ')'
}
ekickx commented 3 years ago

Close in 1952b03