Skip to content

Default name for pasted images when no name is provided. #828

Open
@ErlanRG

Description

@ErlanRG

🚀 The feature, motivation and pitch

When you copy and paste an image directly to obsidian, the default name given is "Pasted image " + date and time.
Can we have this same behavior?

Alternatives

When pasting an image from clipboard, obsidian.nvim currently requires an image name. Otherwise it will fail pasting, logging "Invalid file name" when the string is empty.

  if fname == "" then
    log.err "Invalid file name"
    return
  end

A similar behavior to Obsidian would be to fallback to a formatted name when the name string is empty:

  if fname == "" then
    fname = string.format("Pasted image %s", os.date "%Y%m%d%H%M%S")
  else
    log.err "Invalid file name"
    return
  end

Additional context

This is what it looks like to paste an image from clipboard directly to Obsidian.

Default pasted image name

NOTE: I know there is an option to setup the image name but img_name_func is user specific. My feature request is default behavior.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions