New note in current folder

What I’m trying to do

Assign hotkey to “Create note in current folder”

Things I have tried

I looked at this post as a reference, but I’m still not that familiar with Templater and scripting in Obsidian, so I don’t understand how to achieve this.

I have installed the “Advanced New File” plugin and with some Keyboard Maestro help, I was able to “kinda” mimic what I want, but I was wondering if I could achieve this without relying on Keyboard Maestro?

So basically, I have set a specific folder for all my new notes, which is an “Inbox” folder. That’s what I want Obsidian to do 90% of the time, but sometimes I’m already in a specific folder and I want to create a new note there and I want a different hotkey assigned to it.

1 Like

I suggest using the Create Note in Folder plugin instead. In the plugin’s options you can define a folder named “Current folder” for example and give it the path {{current}}. Then assign “Create Note in Folder: Current folder” to your desired hotkey.

I prefer enabling the plugin’s “List all folders in quick-switcher, instead to open another modal” option, and then assigning a hotkey to “Create Note in Folder: Quick Switcher” to create notes. You can make “Current folder” the top-most folder in the options, then it’s only a matter of pressing your hotkey and pressing Return. In all other cases, press the hotkey and then type/tap/click the folder your want to create a new note in.

2 Likes

Thanks.
I saw that plugin as well, but for some reason it seemed like it wouldn’t do what I wanted to achieve. Just installed and it in fact does that.

Question: do you know if it’s possible to make the title be selected after creating the note? Right now it creates the note with “Untitled” as the title (I’m aware that this can be changed to something else), so it forces me to then go and click the title to change it. Would be good if I was able to just use the hotkey, let it create the note, and then start typing right away. For example if I use the default File > New Note from Obsidian, the title is highlighted.

Do you know if there’s a way to do this?

I think it might be a bug. The plugin’s quite simple and is a bit rough around the edges in certain cases still. You could make a feature request / bug report about it on the plugin’s GitHub. I currently trigger a Templater template (via the plugin’s folder specific settings) which shows a prompt for a filename so I avoid the issue you describe:

<%*
let filename = tp.file.title;
filename = await tp.system.prompt("File name: ", filename);
await tp.file.rename(filename);
-%>

I’ve found that this however also has a bug which shows the Templater prompt twice, but it’s fine to just cancel the second one, which is what I’ve been doing. The prompt also doesn’t have the filename preselected so you have to delete it first, so it’s not perfect…

1 Like

Why do you think it might be a bug? It adds “Untitled” and moves the cursor straight to the body of the note. Maybe that’s how the developer wanted it to be?

I left a comment on the developer’s GitHub requesting this to be an option that the user can toggle on or off. Maybe some users are ok with the default being “Untitled” (or whatever name they use as a default) and so it would be good to be able to pick which method works best for them.

If Templater is causing that issue with having to cancel the second prompt, then my Keyboard Maestro macro is better (while using “Advanced New File”), because it does this automatically for me.

Let’s see if the developer replies to my request.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.