Giter Club home page Giter Club logo

Comments (9)

Vinzent03 avatar Vinzent03 commented on August 22, 2024

I would need to change an internal function in Obsidian, which I really don't want to. It could cause some strange side effects. And adding an extra command for this, is not enough, because there are many ways to create a new file.

from obsidian-hotkeys-for-templates.

Moonbase59 avatar Moonbase59 commented on August 22, 2024

Ah okay, thanks for the heads-up!

from obsidian-hotkeys-for-templates.

Vinzent03 avatar Vinzent03 commented on August 22, 2024

I have found a solution after all. Will do it now.

from obsidian-hotkeys-for-templates.

Moonbase59 avatar Moonbase59 commented on August 22, 2024

@Vinzent03: Wow, this is impressive and really helpful, thanks!

Q: Seems you use the same construct as Templater does (react on new file creation in vault). Would this conflict with Templater if I set both to "Trigger on new file creation"?

Because I have a Templater variable in there (<% tp.file.title %> for first header) that worked before and now always shows "Untitled". Wonder if this is due to "who is first in the chain to handle an event" … It gets expanded, so I assume both of you correctly pass on so the next event handler can take it.

(And thanks for adding that switch!)

from obsidian-hotkeys-for-templates.

Moonbase59 avatar Moonbase59 commented on August 22, 2024

@Vinzent03: Another find:

I naively expected "Folder" to mean "this and all its subfolders", so if I have

  • folder "People" assigned to "Template A"
  • folder "People/Friends & Family" assigned to "Template B"

the following would happen:

  • New note in "People" → Template A
  • New note in "People/Notable" → Template A
  • New note in "People/Friends & Family" → Template B (instead of Template A, because the definition is more specific)

This is from a usability standpoint: I may have, say, a "People" folder with "Friends & Family" and "Notable" subfolders. I would want to use the same template (A) for all kinds of "People", even if I created many new subfolders (without having to specify them all). Or I might rename a few subfolders and wouldn’t have to re-specify them all.

Then I would need a special Template (B) for "People/Friends & Family", so I specify it in settings. This would be applied instead of template A because the path is more specific. And it would also work for subfolders within "People/Friends & Family".

Could this be done? I guess some people might be quite happy about it. :-) (Yes, me too!)
Path "specificity" shouldn’t be too hard to establish, I think.

from obsidian-hotkeys-for-templates.

Vinzent03 avatar Vinzent03 commented on August 22, 2024

Would this conflict with Templater if I set both to "Trigger on new file creation"?

I wouldn't suggest you to enable both features. The filename for a new file is always Untitled, why else did you expect?

Will see what I can do for your folder problem

from obsidian-hotkeys-for-templates.

Moonbase59 avatar Moonbase59 commented on August 22, 2024

Unfortunately, I do need Templater’s trigger to be also enabled (mainly for "New file from template", where I need the template to be executed in places not defined in Hotkeys for templates). But you are right, any file first gets created as "Untitled", so using that Templater variable was probably dumb. 🤣 I must have been thinking it was only done after assigning a name. My mistake.

Thanks a bundle for implementing the new file triggering and looking into the path thing, greatly appreciate it!

from obsidian-hotkeys-for-templates.

Vinzent03 avatar Vinzent03 commented on August 22, 2024

Is available in new release!

from obsidian-hotkeys-for-templates.

Moonbase59 avatar Moonbase59 commented on August 22, 2024

Perfect, works great! Thanks again!

Should probably be noted in the docs that if you use Templater’s "New note from template" or have set Templater’s "Empty file template", and both Hotkeys for Templates and Templater set to trigger on new file creation, both templates will be included in your note.

But I’m perfectly happy with that, can’t expect event chain handlers prioritization. And this would probably be over the head of typical user anyway.

from obsidian-hotkeys-for-templates.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.