Skip to content

Commit 1a6a7c9

Browse files
authored
fix(job): escape square brackets [] from being expanded (#511)
Looks like vim is doing regex string parsing when using `expand` so when using have paths that represent some invalid regex, an error is thrown. In this particular case, the invalid regex came in the form of reverse range: `:expand("[z-a]")` will error out
1 parent bda256f commit 1a6a7c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/plenary/job.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ local function expand(path)
6565
return assert(uv.fs_realpath(path), string.format("Path must be valid: %s", path))
6666
else
6767
-- TODO: Probably want to check that this is valid here... otherwise that's weird.
68-
return vim.fn.expand(vim.fn.escape(path, "$"), true)
68+
return vim.fn.expand(vim.fn.escape(path, "[]$"), true)
6969
end
7070
end
7171

0 commit comments

Comments
 (0)