mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
* fix(tags): fix rg command if PCRE not available (closes #145) Some linux distro do not compile ripgrep using the --pcre2 flag. This commit checks if the --pcre2 flag is available and then tweaks the ripgrep command accordingly. At the moment, it will therefore not be possible to filter-out hexademical color codes from #tags for people that do not have the --pcre2 flag available. This will be documented in a later commit. **Important**: the detection of the PCRE availability is done by trying a simple rg search using _os.execute_. This function interface was changed in Lua 5.2, which means it will break when Neovim will update to Lua >5.1. The fix is already there in commented form. Fixes #145 * refact: cleanup * doc(tag): add note about rg --pcre2 * doc(tag): add note about rg --pcre2 in vim help
This commit is contained in:
@@ -2734,6 +2734,7 @@ local function FindAllTags(opts)
|
||||
opts.tag_notation = M.Cfg.tag_notation
|
||||
local templateDir = Path:new(M.Cfg.templates):make_relative(M.Cfg.home)
|
||||
opts.templateDir = templateDir
|
||||
opts.rg_pcre = M.Cfg.rg_pcre
|
||||
|
||||
if not global_dir_check() then
|
||||
return
|
||||
@@ -2913,6 +2914,16 @@ local function Setup(cfg)
|
||||
M.Cfg.dailies = make_config_path_absolute(M.Cfg.dailies)
|
||||
M.Cfg.weeklies = make_config_path_absolute(M.Cfg.weeklies)
|
||||
M.Cfg.templates = make_config_path_absolute(M.Cfg.templates)
|
||||
|
||||
-- Check if ripgrep is compiled with --pcre
|
||||
-- ! This will need to be fixed when neovim moves to lua >=5.2 by the following:
|
||||
-- M.Cfg.rg_pcre = os.execute("echo 'hello' | rg --pcr2 hello &> /dev/null") or false
|
||||
|
||||
M.Cfg.rg_pcre = false
|
||||
local has_pcre = os.execute("echo 'hello' | rg --pcre2 hello &> /dev/null")
|
||||
if has_pcre == 0 then
|
||||
M.Cfg.rg_pcre = true
|
||||
end
|
||||
end
|
||||
|
||||
M.find_notes = FindNotes
|
||||
|
||||
Reference in New Issue
Block a user