mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
fix: sanitize filesearch
This commit is contained in:
@@ -472,6 +472,7 @@ local function FollowLink(opts)
|
|||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
vim.cmd("normal yi]")
|
vim.cmd("normal yi]")
|
||||||
local title = vim.fn.getreg('"0')
|
local title = vim.fn.getreg('"0')
|
||||||
|
title = title:gsub("^(%[)(.+)(%])$", "%2")
|
||||||
local search_mode = "files"
|
local search_mode = "files"
|
||||||
|
|
||||||
local parts = vim.split(title, "#")
|
local parts = vim.split(title, "#")
|
||||||
@@ -581,6 +582,7 @@ end
|
|||||||
local function PreviewImg(_)
|
local function PreviewImg(_)
|
||||||
vim.cmd("normal yi)")
|
vim.cmd("normal yi)")
|
||||||
local fname = vim.fn.getreg('"0')
|
local fname = vim.fn.getreg('"0')
|
||||||
|
fname = fname:gsub("^(%[)(.+)(%])$", "%2")
|
||||||
|
|
||||||
-- check if fname exists anywhere
|
-- check if fname exists anywhere
|
||||||
local fexists = file_exists(M.Cfg.home .. "/" .. fname)
|
local fexists = file_exists(M.Cfg.home .. "/" .. fname)
|
||||||
@@ -615,6 +617,7 @@ end
|
|||||||
local function FindFriends()
|
local function FindFriends()
|
||||||
vim.cmd("normal yi]")
|
vim.cmd("normal yi]")
|
||||||
local title = vim.fn.getreg('"0')
|
local title = vim.fn.getreg('"0')
|
||||||
|
title = title:gsub("^(%[)(.+)(%])$", "%2")
|
||||||
|
|
||||||
builtin.live_grep({
|
builtin.live_grep({
|
||||||
prompt_title = "Notes referencing `" .. title .. "`",
|
prompt_title = "Notes referencing `" .. title .. "`",
|
||||||
@@ -1017,10 +1020,10 @@ local function Setup(cfg)
|
|||||||
-- setup extensions to filter for
|
-- setup extensions to filter for
|
||||||
M.Cfg.filter_extensions = cfg.filter_extensions or { M.Cfg.extension }
|
M.Cfg.filter_extensions = cfg.filter_extensions or { M.Cfg.extension }
|
||||||
|
|
||||||
-- provide fake filenames for template loading to fail silently if template is configured off
|
-- provide fake filenames for template loading to fail silently if template is configured off
|
||||||
M.Cfg.template_new_note = M.Cfg.template_new_note or 'none'
|
M.Cfg.template_new_note = M.Cfg.template_new_note or "none"
|
||||||
M.Cfg.template_new_daily = M.Cfg.template_new_daily or 'none'
|
M.Cfg.template_new_daily = M.Cfg.template_new_daily or "none"
|
||||||
M.Cfg.template_new_weekly = M.Cfg.template_new_weekly or 'none'
|
M.Cfg.template_new_weekly = M.Cfg.template_new_weekly or "none"
|
||||||
|
|
||||||
-- refresh templates
|
-- refresh templates
|
||||||
M.note_type_templates = {
|
M.note_type_templates = {
|
||||||
|
|||||||
Reference in New Issue
Block a user