fix(git): escape bracket name in :G output bufnr lookup
This commit is contained in:
+1
-6
@@ -109,13 +109,8 @@ local function run_in_split(worktree, args, conf)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Bracket naming so the buffer name doesn't pretend to be a real
|
|
||||||
-- file path (and doesn't collide with the `git://<revspec>` URI
|
|
||||||
-- form used by the BufReadCmd loader). Reused on re-run so a
|
|
||||||
-- second `:G show HEAD` refreshes the existing buffer in place
|
|
||||||
-- instead of leaving a nameless duplicate behind.
|
|
||||||
local name = "[git " .. table.concat(args, " ") .. "]"
|
local name = "[git " .. table.concat(args, " ") .. "]"
|
||||||
local buf = vim.fn.bufnr(name)
|
local buf = vim.fn.bufnr("\\V" .. name)
|
||||||
if buf == -1 or not vim.api.nvim_buf_is_loaded(buf) then
|
if buf == -1 or not vim.api.nvim_buf_is_loaded(buf) then
|
||||||
buf = git.new_scratch()
|
buf = git.new_scratch()
|
||||||
pcall(vim.api.nvim_buf_set_name, buf, name)
|
pcall(vim.api.nvim_buf_set_name, buf, name)
|
||||||
|
|||||||
Reference in New Issue
Block a user