obsidian.nvim icon indicating copy to clipboard operation
obsidian.nvim copied to clipboard

Support for Templater Plugin

Open Weiberle17 opened this issue 1 year ago • 5 comments

🚀 The feature, motivation and pitch

I would love to be able to use my Templater templates. The basic template ist something like <% tp.date.now() %>. I use it for daily notes to link between them. Which isn't possible with the default templates. Right now I need to create the file in the Obsidian App bevor I can edit it within Neovim.

Alternatives

The custom commands are nice but I would have to setup two templates. One that runs whenever I open the file in the app and one for Neovim.

Additional context

https://github.com/SilentVoid13/Templater This is the plugin.

Weiberle17 avatar Mar 02 '24 19:03 Weiberle17

You can define custom substitutions here: https://github.com/epwalsh/obsidian.nvim/blob/main/README.md?plain=1#L372

I have some that look like this:

      templates = {
        subdir = "templates",
        date_format = "%Y-%m-%d-%a",
        time_format = "%H:%M",
        substitutions = {
          yesterday = function()
            return os.date("%Y-%m-%d", os.time() - 24 * 60 * 60)
          end,
          yesterday_with_weekday = function()
            return os.date("%Y-%m-%d-%a", os.time() - 24 * 60 * 60)
          end,
          today_with_weekday = function()
    ...

But the syntax is different than the templater plugin.

sotte avatar Mar 04 '24 13:03 sotte

Yes I know and I like the way this is implemented. I would just really like to be able to have one template that works independent of the method in which I created the note. Sometimes I use Obsidian on my phone before I use it on the computer for example. If this is out of scope I absolutely understand and you can close this issue. I just thought I'd ask for this feature.

Weiberle17 avatar Mar 04 '24 20:03 Weiberle17

I see.

One workaround could be to have two versions of the same template, one for obsidian.nvim and one for the templater plugin. This is, I admit, tedious.

If this is out of scope I absolutely understand and you can close this issue. I just thought I'd ask for this feature.

This is up to @epwalsh to decide.

sotte avatar Mar 05 '24 09:03 sotte

I'd love this feature too. The templater plugin is way cooler than the default one

MovieMaker93 avatar Mar 17 '24 22:03 MovieMaker93