mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
refactor(lua): replace hard-coded gsub with vim.pesc() (#18407)
This commit is contained in:
@@ -1490,7 +1490,7 @@ local function normalize_path(path, as_pattern)
|
|||||||
if as_pattern then
|
if as_pattern then
|
||||||
-- Escape Lua's metacharacters when $HOME is used in a pattern.
|
-- Escape Lua's metacharacters when $HOME is used in a pattern.
|
||||||
-- The rest of path should already be properly escaped.
|
-- The rest of path should already be properly escaped.
|
||||||
normal = vim.env.HOME:gsub('[-^$()%%.%[%]+?]', '%%%0') .. normal:sub(2)
|
normal = vim.pesc(vim.env.HOME) .. normal:sub(2)
|
||||||
else
|
else
|
||||||
normal = vim.env.HOME .. normal:sub(2)
|
normal = vim.env.HOME .. normal:sub(2)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user