Open or Create File
approvedby Ilya Paripsa
Create custom commands that open or create files using configurable patterns and templates.
Open or Create File Obsidian Plugin
This plugin allows adding custom Obsidian commands that create or open files based on predefined patterns, making it easier to maintain daily notes, weekly plans, and other regularly used documents. It reduces the cognitive load by automating the creation of frequently used files.
Please note, I work on this during my spare time of which I have very little. If there are any issues, feel free to raise a PR, but note it might take me some time to respond.
Features
- Open or Create new files from templates
- Support for dynamic file paths using date-based patterns
- Time shift functionality for future/past dates
- Customizable command names for quick access
- Import and Export of custom command configuration as json files
How to configure the plugin
- Go to Obsidian > Settings > Community Plugins > Create or Open File
- Click on Settings cog icon
- Click "Add command" button
- Supply configuration below to configure your new command
- Once created, the command can be executed by opening Command Palette, typing the command name, and pressing Enter.
Example 1: Weekly shopping list
Add configuration below to create a weekly Shopping list command.
Command name: 'Shopping list'
Template file path: '00 - Meta/Templates/shopping-list-template.md'
Destination folder pattern: '01 - Journal/Weekly/Week-{week}'
File name: 'shopping-list.md'
Executing the command will create: 01 - Journal/Weekly/Week-23/shopping-list.md with the template's contents.
Example 2: Tomorrow's daily note
Add configuration below to create a weekly Shopping list command.
Command name: "Tomorrow's Daily Note"
Destination folder: '01 - Journal/Weekly/Week-{week}'
File name: '{month}-{day}-{dow}.md'
Time shift: '+1 day'
Executing the command will create: 01 - Journal/Weekly/Week-23/06-07-Sat.md using tomorrow's date.
Supported placeholders
Use these placeholders in both destination folder paths and file names:
| Placeholder | Example | Description |
|---|---|---|
{year} | 2025 | 4-digit year |
{month} | 06 | 2-digit month |
{day} | 07 | 2-digit day |
{date} | 2025-06-07 | ISO date format |
{time} | 14-30-45 | Time in HH-mm-ss format |
{week} | 23 | ISO week number |
{dow} | Sat | Day of week abbreviation |
Time shifts
Apply time shifts to adjust the date used for pattern resolution:
Format: +N unit or -N unit
- N: number
- unit: day(s), week(s), month(s), year(s)
Examples:
+1 day→ Use tomorrow's date-2 weeks→ Use date from 2 weeks ago+3 months→ Use date from 3 months in the future
Use Previous Note as Template
When enabled, this feature automatically uses the most recent existing note (matching your pattern) as a template for the new note. This is useful for carrying over content like recurring tasks or project status.
How it works
- The plugin detects the time granularity from your path patterns (
{day},{week},{month}, or{year}) - It searches backward in time for existing notes that match the pattern
- The first existing note found becomes the template
Granularity detection
The smallest time unit in your pattern determines the search interval:
{day}or{dow}→ searches daily{week}→ searches weekly{month}→ searches monthly{year}→ searches yearly
Limitations
Time shift unit override: When a time shift is specified, its unit overrides the detected granularity. This can cause unexpected behavior:
- Pattern:
{month}-{day}-{dow}.md(daily granularity) - Time shift:
+1 week - Result: Searches at weekly intervals, not daily
This means if your weekly note was created on Monday but you run the command on Tuesday, the search will skip to the previous week rather than finding Monday's note.
Workaround: Ensure your time shift unit matches your file naming granularity, or rely on the automatic detection by not specifying a time shift.
Support the project
If you find this plugin helpful, consider supporting its development:
- ⭐ Star the project on GitHub
- 💖 Sponsor on GitHub
- 🐛 Report bugs and suggest features
Your support helps me dedicate more time to improving this plugin and developing new features!
Other documentation
- TODO - Planned features and improvements
- Contributing - How to contribute to this project
- Release Notes - Version history and changelog
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.