argenos / nldates-obsidian

Work with dates in natural language in Obsidian
MIT License
477 stars 43 forks source link

Add hotkey to invert "Add dates as link?" option #142

Open jose-elias-alvarez opened 10 months ago

jose-elias-alvarez commented 10 months ago

Motivation for this PR: I'm using the Add dates as link? option, and 95% of the time, I do want to insert a link, but for the other 5%, it's tedious to delete the automatically inserted brackets.

Accordingly, this PR adds Alt as a hotkey modifier for the suggestion modal (like the current Shift hotkey) to do one of two things if held on confirmation:

  1. If the user has enabled the option in question, it inserts the date as plain text
  2. If the user has not enabled the option, it inserts the date as a link (to help users in the opposite situation who may occasionally want to insert a link)

I also considered using a separate trigger character for "inverted" insertions, but I felt that adding a hotkey to the modal was the least intrusive option (and has the advantages of requiring no additional configuration + having a higher level of discoverability).