obsidian-hotkeys-for-templates's Issues
It doesn't work for the subfolder of the path set in text field
I set in path 00.Folder/ using tamplate1. It only works when I create a new file in 00.Folder/, but doesn't work when I create a new file in 00.Folder/01/.
I want to apply the rule in the whole folder even in subfolder.
Creation of a new note via link doesn't trigger the template insertion
Assume that a template _fruitTemplate has been defined for the folder Fruit:
Steps
- Create a note anywhere in the vault with a link of [[Fruit/Apple]]
- Click on the link in that note to create the new note.
Expected Behaviour: a new note called "Apple" is created in the folder "Fruit", with _fruitTemplate inserted
Actual Behaviour: the new note is created, but _fruitTemplate is NOT inserted
Comments
- Vault is set to use absolute paths, in case that has an impact
- this behaviour may be as intended, but personally I'd expect the plugin to insert the template for a folder no matter how that note is created (link, new note hotkey/default folder, file folder right click and new, command palette, etc)
Variables in the template don't work here?
I noticed that the variable is inserted just by text, and not as expected.
{{title}} {{date}} {{time}}
A replacement will come in the standard function.
(little) Conflict with "Filename Heading Sync"
Hi !
I've just tried your plugin and love it !
I've met a little conflict with the "Filename Heading Sync" plugin which sync the file name with the H1 of the note.
So when I create a new note with the sync of the title and the automatic addition of the template : The following actions are done :
- I create the new note
- Filesync sync the filename with the title and so add to the top of the note "# title"
- Hotkey for template add automatically a template to the note at the beginning of the file so before the "#title"
- Filesync sync again the title
Consequence : the title appears both at the beginning and at the end of a note, instead of just being on the top.
Solution : Add a way to consider the H1 title created by "Filename Heading Sync" and add the template below.
Solution 2 : Delay the action of "Filename Heading Sync" , so that the template is first loaded and then the title synced.
Would it be possible to implement one of those solutions ? I can also open an issue on the side of the Filename Heading Sync plugin.
Many thanks for your work !
Michaël
Applies the template twice
When "Trigger on file creation" is active and a hotkey is specified for a new file in a specified folder, upon pressing the hotkeys, the template gets applied twice. I don't want to add hotkey for certain folder but simply enable trigger template on creation whereas I use hotkey for some folders for new note creation.
Error upon opening: Failed to load plugin obsidian-hotkeys- for-templates
I reviewed issue #21, thinking I had the same issue, but this appears to be something different. I have my template directory defined in the core templates plugin and also the templater plugin. I keep my templates in Setup/templates
, which may be a little unusual, so I changed it to just templates
for testing purposes but have the same issue.
This has been working for a very long time. I am now running the latest pre-release, so there may have been a config change in the core app. >shrug<
I should also note that I completely removed the plugin and ensured the plugin directory was removed and reinstalled... just in case there was some syncing funny business going on.
Upon loading Obsidian, I get the following error.
If I examine the console, I see.
Thanks for the great plugin.
Cannot configure the plugin in Preferences
Hey
Firstly thanks for making this plugin. It's super useful to be able to assign to a hotkey the ability to create a new file in a location for a template.
It's been a while since I've had to touch the settings for this so apologies if I am using it wrong. I noticed that the settings for the plugin in the Obsidian preferences was empty.
![image](https://private-user-images.githubusercontent.com/34041368/261288067-a847fb50-95f8-4b0a-82ea-df2df2cea4b4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2MDUzNzEsIm5iZiI6MTcyMzYwNTA3MSwicGF0aCI6Ii8zNDA0MTM2OC8yNjEyODgwNjctYTg0N2ZiNTAtOTVmOC00YjBhLTgyZWEtZGYyZGYyY2VhNGI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE0VDAzMTExMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThiYWIyMmNlMjFjMGRlY2VjMzZmMmQ0NGRkN2NiM2I0NTA4NzkzZWU0YmMwOTUxY2Q1NTkwMWJiMWU4YmQxZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GSpAQuK0cfXb08nH92rcs7gPgf6uuiZ9QbsDIYCJblc)
I am using the latest version of the plugin, and I am running Obsidian v1.4.3.
Please let me know if you need any more info, thank you!
After changing/removing "Add new note" entry, hotkey still available
I used "add new text field" to enter Folder=People
and Template=Templater: Character
, then later changed it to Folder=People/Friends & Family
, Template=Templater: Character
.
Under Settings → Hotkeys, it now still shows both:
Using Obsidian 0.12.3 on Linux, Hotkeys for templates 1.2.1, Templater 1.6.0.
Only after restarting Obsidian, the Hotkeys entries are shown correctly again.
Wrap contents of template around selected text
I'd love if shortcuts for templates could paste and wrap contents of templates around our selected text in edit mode.
Is this possible?
Invoke with Tab
This plugin is awesome. Is there a way to invoke it using only the Tab key? I want to replace the default Tab function with
Not compatible with Templater v1.6.0
Hey all,
Updated to Templater v1.6.0 earlier today and as a result the following feature, in this plug, did not work...
I have keyboard shortcuts tied to these too and after updating Tempalter … all I got was an Untitled page in the folder specified.
So this was the code I adjusted to fix it...
In .obsidian\plugins\obsidian-hotkeys-for-templates\main.js
, I adjusted LINE 2372 from,
case 1: return [4 /*yield*/, this.templaterPlugin.parser.replace_templates_and_append(file)];
to:
case 1: return [4 /*yield*/, this.templaterPlugin.templater.append_template(file)];
Regards,
://mk
Bug when using hotkeys for templates that work on selected words.
Hi I've been trying set up hotkeys for a simple template file like such:
<mark class="blue"><% tp.file.selection() %></mark>
The template works as expected when I use the Templater plugin. However when I use the hotkeys , the selected words doesn't seem to be passed on to the template script like the result below
Is this a known bug?
New file creation along with tp.file.move/tp.file.rename results in extra empty file
I have the following template. It's got a little bit of templater script at the bottom to update a value in the template and move/rename the output file. It doesn't matter if I use tp.file.move
or tp.file.rename
, in both cases, no matter the output path configured for the new file hotkey, I end up with an extra empty Untitled.md
note. This extra note does not get created if using the Templater: Create new note from template
command and selecting the same output folder as the hotkey.
---
metatable: true
title: Untitled
campaign: Curse of Strahd
session: 005
session_date: <% tp.date.now("MM.DD.YYYY") %>
tags: RPG/CurseOfStrahd, RPG/SessionNotes/DM
notes_folder: "/RPGs/Curse of Strahd/Meta/Session Notes/"
---
# `= this.title`
⬅ [[|Last Session]] / [[|Next Session]] ➡
**date:** `= this.session_date`
**PC:** [[Anton (Valros)|Anton]], [[Lucky Tenny]], [[Viktor Voronkov]], [[Zoe]]
**NPC Active:**
**NPC Discussed:**
**Location Active:**
**Location Discussed:**
**Monsters:**
## Post session notes
## To do before next session
## Soon
<%*
const frontmatter = this.app.metadataCache.getFileCache(tp.config.template_file)?.frontmatter;
const {update} = this.app.plugins.plugins["metaedit"].api;
// Get current session number, next session number
const oldNumber = frontmatter.session;
const newNumber = `${oldNumber + 1}`.padStart(3, '0');
const oldNumberPadded = `${oldNumber}`.padStart(3, '0');
// Update title of new file
let title = tp.file.title;
if (title.startsWith("Untitled")) {
title = `S${oldNumberPadded} ${tp.date.now("MM.DD.YYYY")}`;
await tp.file.rename(`${title}`);
}
// Update session number in template
await update('session', newNumber, tp.config.template_file);
%>
The extra file ends up in the folder specified in the hotkey.
Bug interacting with Templater
OS: Windows 10
Hotkeys for Templates 1.4.2 -- Templater version: >1.8.1
Obsidian version: 0.12.16
Templater ... ## <% tp.date.now("HHmm") %> –
Describe the bug
I have the above Template attached to a hotkey (using the 'Hotkeys for Templates' plugin - Alt+T). It has stopped working in the last 24 hours (>v1.8.1 of Templater).
Expected behaviour
Alt+T calls and renders an H2 with the current time.
Additional context
I initially posted a bug report on the Templater git - they got back to me with the following (apologies for this, as I don’t really understand what they are actually saying here)...
"I believe you will find a this.templaterPlugin.templater.append_template
is not a function error in the console.
I think this error comes from the append_template
having changed name during a refactor. This should probably be filed as a bug with Hotkeys For Templates
plugin, not Templater
itself."
[Feature request] Create note in a given folder from template
Would it be possible to allow hotkeys to create a new note in a specified folder from a given template? For example, this would allow me to create a new "task" note in 1 shot. Thanks!
[Feature Request] Add generic hotkey to create file from template
Right now one has to create a new hotkey for every template. It would be nice to have one hotkey, which then queries me for the template, I want to use and then creates the correct template.
If core Templates plugin is replaced with Templater (i.e. core plugin=off) it doesn't work
fixes are in PR #1
Feature Request: Possible to trigger new templated note WITHOUT using a hotkey or command?
Just asking: Since we can enter folder/template pairs already to specify which template should be used for which file when creating a new note, would it be possible to have this when not using a hotkey or command palette command?
For example, I would create a new file using the Obsidian functions (Ctrl+N, right-click in file explorer and select "New Note" or the like) within a folder that is specified in the plugin settings, could it then also automatically intervene and apply the specified template?
This would make it so much more usable (we only have so many keys …), by just always creating a templated new note within specified folders!
Plugin Options blank on v0.12.12
When I activate the plugin and go to Plugin Options, the page is blank with no fields, switches, or text of any kind. Could this be something with v0.12.12?
Default Template doesn't work with nested folders
Hi @Vinzent03!
CC @Moonbase59
Thank you so much for adding support for default templates for specific folders!
I have noticed that it currently doesn't work with nested folders though, which is something I would find super useful.
Expected Behaviour
Default templates work for nested folder structures.
- 'Deepest match' has priority (if both
/a/
and/a/b/
have templates specified, use template for/a/b/
Actual Behaviour
Does not work for nested folders.
My setup is:
But the template is only activated for files that are in /
directly, not in, for example /Physics/
.
This is not just for defining templates in /
though. I have a template set for /Physics/
as well in order to try to alleviate this, but /Phyiscs/Quantum/newfile.md
will not make use of the /Physics/
template.
When moving a template from folder, hotkeys for template doesn't update template path
Hi,
When moving a template from folder, hotkeys for template doesn't update template path for already set hotkeys.
To recreate the bug :
- Create a template X
- enable the template hotkey in "hotkey for template" settings
- Create a hotkey in "hotkeys" settings
- Move the template X in another folder
- Come back in hotkey for template settings. Here you should see that the template X is disabled as it has been moved in the other folder
- Check the "hotkeys" settings. The hotkey for the old template X path still exists. The only way to remove it is to move back template x in the previous path, then disable the template hotkey in "hotkey of template" settings (or edit the hotkeys file of obsidian manually). Then move it and enable it again.
Again thanks a lot for this plugin, it saves me time everyday.
Enjoy your day !
Michaël
Edit : Same happen if changing the name of a template.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.