Add follow_url_fallback config option (#172)

* Add follow_link_fallback config option
* Update README.md
* Rename follow_link_fallback to follow_url_fallback. Change logic of configuring
This commit is contained in:
Anatolii Kurotych
2022-10-17 22:00:24 +02:00
committed by GitHub
parent 923274dfb8
commit 60808e8e59
3 changed files with 19 additions and 0 deletions

View File

@@ -156,6 +156,9 @@ local function defaultConfig(home)
-- "catimg-previewer" if you have catimg installed
-- "viu-previewer" if you have viu installed
media_previewer = "telescope-media-files",
-- A customizable fallback handler for urls.
follow_url_fallback = nil,
}
M.Cfg = cfg
M.note_type_templates = {
@@ -1473,6 +1476,11 @@ local function check_for_link_or_tag()
end
local function follow_url(url)
if M.Cfg.follow_url_fallback then
local cmd = string.gsub(M.Cfg.follow_url_fallback, "{{url}}", url)
return vim.cmd(cmd)
end
-- we just leave it to the OS's handler to deal with what kind of URL it is
local function format_command(cmd)
return 'call jobstart(["'