From 92160e2eb6839e700099771a262f03cd9d92f841 Mon Sep 17 00:00:00 2001 From: Chad Lamb Date: Fri, 23 Jun 2023 14:15:30 +0200 Subject: [PATCH] fix(is_template check): swap out call to viml string match function for 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. --- lua/obsidian/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/obsidian/init.lua b/lua/obsidian/init.lua index 2f8222e60..e9f99111e 100644 --- a/lua/obsidian/init.lua +++ b/lua/obsidian/init.lua @@ -98,7 +98,7 @@ obsidian.setup = function(opts) if self.opts.templates ~= nil then local templates_pattern = "^" .. tostring(self.dir / self.opts.templates.subdir / ".*") is_template = function(match) - return vim.fn.matchstr(match, templates_pattern) ~= "" + return string.find(match, templates_pattern) ~= nil end else is_template = function(_)