plugins.clipboard-image.filetypes

Override certain options for specific filetypes.

Type: attribute set of (submodule)

Default: { }

Example:

{
  markdown = {
    imgDir = [
      "src"
      "assets"
      "img"
    ];
    imgDirTxt = "/assets/img";
    imgHandler = ''
      function(img)
        local script = string.format('./image_compressor.sh "%s"', img.path)
        os.execute(script)
      end
    '';
  };
}

Declared by:

plugins.clipboard-image.filetypes.<name>.affix

String that sandwiched the image’s path.

Default:

  • default: "{img_path}"
  • markdown: "![]({img_path})"

Note: Affix can be multi lines, like this:

# You can use line break escape sequence
affix = "<\n  %s\n>";
# Or lua's double square brackets
affix.__raw = \'\'
  [[<
    %s
  >]]
\'\'

Type: null or string or raw lua code

Default: null

Declared by:

plugins.clipboard-image.filetypes.<name>.imgDir

Dir name where the image will be pasted to.

Note: If you want to create nested dir, it is better to use table since windows and unix have different path separator.

Type: null or string or list of string or raw lua code

Default: null

Plugin default: "img"

Declared by:

plugins.clipboard-image.filetypes.<name>.imgDirTxt

Dir that will be inserted into text/buffer.

Type: null or string or list of string or raw lua code

Default: null

Plugin default: "img"

Declared by:

plugins.clipboard-image.filetypes.<name>.imgHandler

Function that will handle image after pasted.

Note: img is a table that contain pasted image’s {name} and {path}.

Type: null or lua function string

Default: null

Plugin default: "function(img) end"

Declared by:

plugins.clipboard-image.filetypes.<name>.imgName

Image’s name.

Type: null or string or raw lua code

Default: null

Plugin default:

{
  __raw = "function() return os.date('%Y-%m-%d-%H-%M-%S') end";
}

Declared by: