Templater
Templater copied to clipboard
tp.file.cursor(1) not working
Plugin informations (please complete the following information):
- OS: Windows 10
- Templater version: 1.9.9
- Obsidian version: v0.12.15
Describe the bug
When I insert a template that has <%tp.file.cursor(1)%>
, this is not replaced by the cursor
Expected behavior This code should be replaced by the cursor
Screenshots Here is a screen recording
https://user-images.githubusercontent.com/80294221/135774090-4dcde689-d07f-4d4c-8a06-cb3d84e2978a.mp4
Extra information:
I noticed this happened because of the latest version: 1.9.9, because when I downgraded to the previous version (1.9.8) it worked properly.
Hey @Lorena1908, the automatic cursor jump is now disabled by default. You can enable it back in the settings of Templater.
Thank you for the great extension @SilentVoid13 !
That the automatic cursor jump needs to be enabled separately might be something worth mentioning in the docs. Being new to the extension, it puzzled me greatly that omitting the ()
printed out the function body, while having the ()
just did nothing. Even if the automatic cursor jump is disabled, I would expect to see the code block disappear, but I guess there exists some good reasons why this isn't so :)
well, it's ok for it to be configurable, but I think it's really not a good idea to add a setting with the default opposite of the current behaviour. and a dozen bug reports for the same issue is an obvious result.
It was confusing to me that it looks like it doesn't parse the entire code block. (eg: it prints the text of <% tp.file.cursor(1) %>
in the output)
suggest instead to:
- replace with blank string in the output
- log a console warning/info if the setting is off
- turn the setting on by default (unless there's some downside to this?)
Whether it was broken before or not, it's definitely broken now for me using latest stable versions of plugin (1.12.0) and Obsidian (0.15.9) on Mac. Double-checked that I still have the setting set to on, but it's just showing the string and not replacing it. Please fix!
It defaults to file name now
Can confirm defaulting to file name for me after update to 1.14.1 for me this morning. Hope there is a fix for it
Obsidian's default behaviour has changed which is why this command no longer works as expected.
This is not working in v0.15.9, the hotkey "Templater: Jump to next cursor location" IS WORKING but not the automatic jump. Hoping there is a fix for this.
It costs me half an hour to figgle around and find this.
For me <% tp.file.cursor(1) %> does not work at all, but I'm new with templater. I need a precise guide (preferable in the docs).
Sorry to hear. It's still broken last I checked and it'll be a while before it gets fixed. If anyone wants to take a stab at it, I'm happy to guide them!
Also happy to merge a warning in the docs that this isn't working as expected right now.
It costs me half an hour to figgle around and find this.
For me <% tp.file.cursor(1) %> does not work at all, but I'm new with templater. I need a precise guide (preferable in the docs).
came here to say this. exact same situation
just to add that it does work when the note is created with templaters own cmd + p
methods - but I was using the quickAdd plugin to create my templates and it doesn't work with that out of the box so if your using the quickadd plugin (or I assume another) enabling trigger template on new file creation will fix it.
my template
---
title: '<%tp.file.title%>'
tags:
visibility: private
created: <%tp.date.now("Y-MM-DDTHH:mm:ssZZ")%>
---
# <%tp.file.title%>
<%tp.file.cursor(0)%>
## Links
-
## Reference
-