Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ErlanRG opened this issue Feb 18, 2025 · 0 comments
Open

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

ErlanRG opened this issue Feb 18, 2025 · 0 comments

Comments

@ErlanRG
Copy link

ErlanRG commented Feb 18, 2025

🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant