mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
Escape parentheses from titles when searching for backlinks
This commit is contained in:
committed by
Anderson Lizarazo Tellez
parent
3fd50c62c1
commit
d6e4990425
@@ -1873,12 +1873,16 @@ local function ShowBacklinks(opts)
|
|||||||
local title =
|
local title =
|
||||||
Pinfo:new({ filepath = vim.fn.expand("%:p"), M.Cfg }).title
|
Pinfo:new({ filepath = vim.fn.expand("%:p"), M.Cfg }).title
|
||||||
-- or vim.api.nvim_buf_get_name(0)
|
-- or vim.api.nvim_buf_get_name(0)
|
||||||
|
|
||||||
|
local escaped_title = string.gsub(title, "%(", "\\(")
|
||||||
|
escaped_title = string.gsub(escaped_title, "%)", "\\)")
|
||||||
|
|
||||||
builtin.live_grep({
|
builtin.live_grep({
|
||||||
results_title = "Backlinks to " .. title,
|
results_title = "Backlinks to " .. title,
|
||||||
prompt_title = "Search",
|
prompt_title = "Search",
|
||||||
cwd = M.Cfg.home,
|
cwd = M.Cfg.home,
|
||||||
search_dirs = { M.Cfg.home },
|
search_dirs = { M.Cfg.home },
|
||||||
default_text = "\\[\\[" .. title .. "([#|].+)?\\]\\]",
|
default_text = "\\[\\[" .. escaped_title .. "([#|].+)?\\]\\]",
|
||||||
find_command = M.Cfg.find_command,
|
find_command = M.Cfg.find_command,
|
||||||
attach_mappings = function(_, map)
|
attach_mappings = function(_, map)
|
||||||
actions.select_default:replace(picker_actions.select_default)
|
actions.select_default:replace(picker_actions.select_default)
|
||||||
|
|||||||
Reference in New Issue
Block a user