From a3daba4cafad13651538f6c0c00a7ef071170028 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Tue, 18 Jan 2022 18:57:56 +0100 Subject: [PATCH 1/5] fix #69 --- lua/telekasten.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index ae2563d..382a288 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -188,7 +188,11 @@ local function global_dir_check() ret = ret and check_dir_and_ask(M.Cfg.dailies, "dailies") ret = ret and check_dir_and_ask(M.Cfg.weeklies, "weeklies") ret = ret and check_dir_and_ask(M.Cfg.templates, "templates") - ret = ret and check_dir_and_ask(M.Cfg.image_subdir, "image_subdir") + ret = ret + and check_dir_and_ask( + M.Cfg.home .. "/" .. M.Cfg.image_subdir, + "image_subdir" + ) return ret end @@ -2128,6 +2132,8 @@ local function FollowLink(opts) return rawget(t, rawget(lookup_keys, k)) end, } + + -- if opts.show_link_counts then mt_vimgrep_entry.display = make_display else From 42241c1e1567e4d9d9ff131fcbf31ffe8351df33 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Tue, 18 Jan 2022 19:10:50 +0100 Subject: [PATCH 2/5] re-fix #69 proper handling of img subdir in dir check --- lua/telekasten.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 382a288..990d0e5 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -188,11 +188,12 @@ local function global_dir_check() ret = ret and check_dir_and_ask(M.Cfg.dailies, "dailies") ret = ret and check_dir_and_ask(M.Cfg.weeklies, "weeklies") ret = ret and check_dir_and_ask(M.Cfg.templates, "templates") - ret = ret - and check_dir_and_ask( - M.Cfg.home .. "/" .. M.Cfg.image_subdir, - "image_subdir" - ) + + local img_dir = M.Cfg.home + if M.Cfg.image_subdir then + img_dir = img_dir .. "/" .. M.Cfg.image_subdir + end + ret = ret and check_dir_and_ask(img_dir, "image_subdir") return ret end From 5d32eb2fe1a09491f7ca48507104324e0ccde170 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Tue, 18 Jan 2022 20:14:20 +0100 Subject: [PATCH 3/5] Help #68 with (hopefully) more error output --- lua/taglinks/tagutils.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/taglinks/tagutils.lua b/lua/taglinks/tagutils.lua index abcf22f..e44b31f 100644 --- a/lua/taglinks/tagutils.lua +++ b/lua/taglinks/tagutils.lua @@ -112,8 +112,13 @@ M.do_find_all_tags = function(opts) args = args, enable_recording = true, on_exit = function(j, return_val) - for _, line in pairs(j:result()) do - parse_entry(opts, line, ret) + if return_val == 0 then + for _, line in pairs(j:result()) do + parse_entry(opts, line, ret) + end + else + print("rg return value: " .. tostring(return_val)) + print("stderr: ", vim.inspect(j:stderr_result())) end end, on_stderr = function(err, data, _) From 065a4497590116cf0d1eadffe578277fae58a4d5 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Wed, 19 Jan 2022 07:35:51 +0100 Subject: [PATCH 4/5] fix #68 yaml-bare tag lists without comma --- lua/taglinks/tagutils.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/taglinks/tagutils.lua b/lua/taglinks/tagutils.lua index e44b31f..c582f08 100644 --- a/lua/taglinks/tagutils.lua +++ b/lua/taglinks/tagutils.lua @@ -60,7 +60,7 @@ local function yaml_to_tags(line, entry, ret) local i = 1 local j - local prev_i + local prev_i = 1 local tag while true do i, j = line:find("%s*.*%s*,", i) @@ -73,6 +73,9 @@ local function yaml_to_tags(line, entry, ret) end local new_entry = {} + + -- strip trailing ] + tag = tag:gsub("]", "") new_entry.t = tag new_entry.l = entry.l new_entry.fn = entry.fn From b8767dd9e3e28c357ae90c7fffc5d5653c4d8931 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Wed, 19 Jan 2022 08:19:32 +0100 Subject: [PATCH 5/5] fix follow-up picker for nvim-0.7 nightly with latest telescope --- lua/telekasten.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 990d0e5..311bcfa 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -2196,10 +2196,11 @@ local function FollowLink(opts) ) -- builtin.live_grep({ - pickers.new({ + local picker = pickers.new({ cwd = cwd, prompt_title = "Notes referencing `" .. title .. "`", default_text = search_pattern, + initial_mode = "insert", -- 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]] @@ -2218,7 +2219,8 @@ local function FollowLink(opts) map("n", "", picker_actions.paste_link(opts)) return true end, - }):find() + }) + picker:find() end end @@ -2451,15 +2453,16 @@ local function FindAllTags(opts) sorter = conf.generic_sorter(opts), attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() - actions._close(prompt_bufnr, true) - -- actions for insert tag, default action: search for tag local selection = action_state.get_selected_entry().value.tag local follow_opts = { follow_tag = selection, show_link_counts = true, } - FollowLink(follow_opts) + actions._close(prompt_bufnr, false) + vim.schedule(function() + FollowLink(follow_opts) + end) end) map("i", "", picker_actions.yank_tag(opts)) map("i", "", picker_actions.paste_tag(opts))