Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(is_template check): swap out call to viml string match function for builtin lua function. #145

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

lamb003
Copy link
Contributor

@lamb003 lamb003 commented Jun 23, 2023

Hi @epwalsh,

Thanks for the great plugin, I have just noticed this bug on my system. I'm not sure anyone else has experienced it but I thought I'd propose a fix since it seemed pretty straightforward. (Although I'm no Lua expert)

The issue is that for a path to a vault that contained tildes (like a path to a folder in iCloud), the is_template function throws errors when calling the vim matchstr function. Swapping it out for the lua string match function eliminated the error for me.

example setup that previously caused errors.

require("obsidian").setup({
dir="/Users/person/Library/Mobile Documents/iCloud~md~obsidian/Documents/Notes",
    notes_subdir = "fleeting",
    templates = {
      subdir = "Templates",
      date_format = "%Y-%m-%d-%a",
      time_format = "%H:%M"
  },
...

…or builtin lua function.

This is useful for paths that contain tildes that need to be escaped. i.e. if the path to the vault is in an iCloud folder like:
`/Users/person/Library/Mobile Documents/iCloud~md~obsidian/Documents/Notes`

using the viml string match currently throws an error if the user's vault path contains tildes.
Copy link
Owner

@epwalsh epwalsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix @lamb003!

@epwalsh epwalsh merged commit e2fe028 into epwalsh:main Jun 23, 2023
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants