From b4c7f763f93e17201884cf802eb4153ccd52ea6c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 3 May 2022 20:56:26 -0400 Subject: [PATCH] refactor(lua): replace hard-coded gsub with vim.pesc() --- runtime/lua/vim/filetype.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 77ebb64b1d..32f4f825c1 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1490,7 +1490,7 @@ local function normalize_path(path, as_pattern) if as_pattern then -- Escape Lua's metacharacters when $HOME is used in a pattern. -- 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 normal = vim.env.HOME .. normal:sub(2) end