ekickx / clipboard-image.nvim

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

feat: picker for existed image file #19

Closed ekickx closed 2 years ago

ekickx commented 2 years ago

This plugin at first only intended to copy image from clipboard but recently I want reuse those images that have been copied. This pr will add two new commands: :PasteImgPick and :PasteImgPickers. Also currently the config will look like this:

{
  pickers = {
    default = {
      default_picker = 'cmdline'
    },
    telescope_fd = {
      finder = 'find'
    }
  },
  default = {<opts>},
  <filetype> = {<opts>}
}

The new config introduces pickers table. So the idea is user can create picker with pick.register_pickers(<picker>) and configure it through that pickers table. The current built-in pickers are default, cmdline, and telescope_fd.

:PasteImgPickers is to select your picker, like this :PasteImgPickers telescope_fd. While :PasteImgPick is just an alias of :PasteImgPickers default. From the above config, :PasteImgPickers default will run :PasteImgPickers cmdline.

Here is the demos:

Note: I use wilder in this demo

Cmdline picker

cmdline demo

Telescope_fd picker

telescope_fd demo


So what do you think? If there's anything you don't like or you think can be implemented better, please tell me.

ekickx commented 2 years ago

Probably I will just make a new plugin to avoid bloating the current code base.