Open or Create File

approved

by Ilya Paripsa

Create custom commands that open or create files using configurable patterns and templates.

2 stars296 downloadsUpdated 5d agoAGPL-3.0
View on GitHub

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

  1. Go to Obsidian > Settings > Community Plugins > Create or Open File
  2. Click on Settings cog icon
  3. Click "Add command" button
  4. Supply configuration below to configure your new command
  5. 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:

PlaceholderExampleDescription
{year}20254-digit year
{month}062-digit month
{day}072-digit day
{date}2025-06-07ISO date format
{time}14-30-45Time in HH-mm-ss format
{week}23ISO week number
{dow}SatDay 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

  1. The plugin detects the time granularity from your path patterns ({day}, {week}, {month}, or {year})
  2. It searches backward in time for existing notes that match the pattern
  3. 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

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.