Show signs in fugitive revision buffers

Resolves #143
This commit is contained in:
Lewis Russell 2021-04-13 09:16:24 +00:00
parent 33bda75591
commit 7c493175f3
2 changed files with 21 additions and 3 deletions

View File

@ -391,12 +391,21 @@ local function apply_keymaps(bufonly)
end
local function get_buf_path(bufnr)
return
uv.fs_realpath(api.nvim_buf_get_name(bufnr)) or
local file =
uv.fs_realpath(api.nvim_buf_get_name(bufnr)) or
api.nvim_buf_call(bufnr, function()
return vim.fn.expand('%:p')
end)
if vim.startswith(file, 'fugitive://') then
local orig_path = file
file = file:gsub('^fugitive:', ''):gsub('%.git/+%x-/', '')
file = uv.fs_realpath(file)
dprint(("Fugitive buffer for file '%s' from path '%s'"):format(file, orig_path), bufnr)
end
return file
end
local function index_handler(cbuf)

View File

@ -391,12 +391,21 @@ local function apply_keymaps(bufonly: boolean)
end
local function get_buf_path(bufnr: integer): string
return
local file =
uv.fs_realpath(api.nvim_buf_get_name(bufnr))
or
api.nvim_buf_call(bufnr, function(): string
return vim.fn.expand('%:p')
end)
if vim.startswith(file, 'fugitive://') then
local orig_path = file
file = file:gsub('^fugitive:',''):gsub('%.git/+%x-/', '')
file = uv.fs_realpath(file)
dprint(("Fugitive buffer for file '%s' from path '%s'"):format(file, orig_path), bufnr)
end
return file
end
local function index_handler(cbuf: integer): function