mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
Merge branch 'main' into RenameNote
This commit is contained in:
@@ -60,7 +60,7 @@ local function yaml_to_tags(line, entry, ret)
|
|||||||
|
|
||||||
local i = 1
|
local i = 1
|
||||||
local j
|
local j
|
||||||
local prev_i
|
local prev_i = 1
|
||||||
local tag
|
local tag
|
||||||
while true do
|
while true do
|
||||||
i, j = line:find("%s*.*%s*,", i)
|
i, j = line:find("%s*.*%s*,", i)
|
||||||
@@ -73,6 +73,9 @@ local function yaml_to_tags(line, entry, ret)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local new_entry = {}
|
local new_entry = {}
|
||||||
|
|
||||||
|
-- strip trailing ]
|
||||||
|
tag = tag:gsub("]", "")
|
||||||
new_entry.t = tag
|
new_entry.t = tag
|
||||||
new_entry.l = entry.l
|
new_entry.l = entry.l
|
||||||
new_entry.fn = entry.fn
|
new_entry.fn = entry.fn
|
||||||
@@ -112,8 +115,13 @@ M.do_find_all_tags = function(opts)
|
|||||||
args = args,
|
args = args,
|
||||||
enable_recording = true,
|
enable_recording = true,
|
||||||
on_exit = function(j, return_val)
|
on_exit = function(j, return_val)
|
||||||
for _, line in pairs(j:result()) do
|
if return_val == 0 then
|
||||||
parse_entry(opts, line, ret)
|
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
|
||||||
end,
|
end,
|
||||||
on_stderr = function(err, data, _)
|
on_stderr = function(err, data, _)
|
||||||
|
|||||||
@@ -191,7 +191,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.dailies, "dailies")
|
||||||
ret = ret and check_dir_and_ask(M.Cfg.weeklies, "weeklies")
|
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.templates, "templates")
|
||||||
ret = ret and check_dir_and_ask(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
|
return ret
|
||||||
end
|
end
|
||||||
@@ -2200,6 +2205,8 @@ local function FollowLink(opts)
|
|||||||
return rawget(t, rawget(lookup_keys, k))
|
return rawget(t, rawget(lookup_keys, k))
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--
|
||||||
if opts.show_link_counts then
|
if opts.show_link_counts then
|
||||||
mt_vimgrep_entry.display = make_display
|
mt_vimgrep_entry.display = make_display
|
||||||
else
|
else
|
||||||
@@ -2261,10 +2268,11 @@ local function FollowLink(opts)
|
|||||||
)
|
)
|
||||||
|
|
||||||
-- builtin.live_grep({
|
-- builtin.live_grep({
|
||||||
pickers.new({
|
local picker = pickers.new({
|
||||||
cwd = cwd,
|
cwd = cwd,
|
||||||
prompt_title = "Notes referencing `" .. title .. "`",
|
prompt_title = "Notes referencing `" .. title .. "`",
|
||||||
default_text = search_pattern,
|
default_text = search_pattern,
|
||||||
|
initial_mode = "insert",
|
||||||
-- link to specific file (a daily file): [[2021-02-22]]
|
-- 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 in specific file (a daily file): [[2021-02-22#Touchpoint]]
|
||||||
-- link to heading globally [[#Touchpoint]]
|
-- link to heading globally [[#Touchpoint]]
|
||||||
@@ -2283,7 +2291,8 @@ local function FollowLink(opts)
|
|||||||
map("n", "<c-cr>", picker_actions.paste_link(opts))
|
map("n", "<c-cr>", picker_actions.paste_link(opts))
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
picker:find()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2516,15 +2525,16 @@ local function FindAllTags(opts)
|
|||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
attach_mappings = function(prompt_bufnr, map)
|
attach_mappings = function(prompt_bufnr, map)
|
||||||
actions.select_default:replace(function()
|
actions.select_default:replace(function()
|
||||||
actions._close(prompt_bufnr, true)
|
|
||||||
|
|
||||||
-- actions for insert tag, default action: search for tag
|
-- actions for insert tag, default action: search for tag
|
||||||
local selection = action_state.get_selected_entry().value.tag
|
local selection = action_state.get_selected_entry().value.tag
|
||||||
local follow_opts = {
|
local follow_opts = {
|
||||||
follow_tag = selection,
|
follow_tag = selection,
|
||||||
show_link_counts = true,
|
show_link_counts = true,
|
||||||
}
|
}
|
||||||
FollowLink(follow_opts)
|
actions._close(prompt_bufnr, false)
|
||||||
|
vim.schedule(function()
|
||||||
|
FollowLink(follow_opts)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
map("i", "<c-y>", picker_actions.yank_tag(opts))
|
map("i", "<c-y>", picker_actions.yank_tag(opts))
|
||||||
map("i", "<c-i>", picker_actions.paste_tag(opts))
|
map("i", "<c-i>", picker_actions.paste_tag(opts))
|
||||||
|
|||||||
Reference in New Issue
Block a user