From 4914c9d639581aa24959a22bb0ac3f18b1a3fbc4 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Wed, 1 Dec 2021 14:24:45 +0100 Subject: [PATCH] Fix #15: silly bug caused following non-special links to crash --- README.md | 3 ++- lua/telekasten.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 420d119..252c86a 100644 --- a/README.md +++ b/README.md @@ -388,7 +388,8 @@ You can `follow_link()` all of the above, with the exception of media links, whi Note that notes linked to with headings or paragraph IDs **will not be created automatically**. Non-existing notes will be ignored, a global search will be performed instead. -For now, you have to create such links yourself. You can edit existing links and append headings, for example: From `[[The note]]` to `[[The note#Some heading or subheading]]`. +For now, you have to create such links yourself. You can edit existing links and append headings, for example: From +`[[The note]]` to `[[The note#Some heading or subheading]]`. Regarding linking to paragraphs: The `^blockid` notation is supported by more and more tools now. It works like this: diff --git a/lua/telekasten.lua b/lua/telekasten.lua index f423f5a..5d50550 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -473,7 +473,7 @@ local function FollowLink(opts) local search_mode = "files" local parts = vim.split(title, "#") - local filename + local filename = '' -- if there is a # if #parts ~= 1 then @@ -560,6 +560,7 @@ local function FollowLink(opts) cwd = cwd, prompt_title = "Notes referencing `" .. title .. "`", default_text = search_pattern, + -- link to specific file (a daily file): [[2021-02-22]] -- link to heading in specific file (a daily file): [[2021-02-22#Touchpoint]] -- link to heading globally [[#Touchpoint]] -- link to heading in specific file (a daily file): [[The cool note#^xAcSh-xxr]]