lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
5.12k stars 192 forks source link

Add mapping to disable `Gitsigns blame` and return to editable buffer #1107

Closed ambroisie closed 3 months ago

ambroisie commented 3 months ago

Description

When using Gitsigns blame, if I use the "reblame at [parent] commit", then dismiss the blame sidebar, I end up with an un-editable buffer from that historical view instead of the on-disk file.

Neovim version

v0.10.0

Operating system and version

NixOS unstable

Expected behavior

I would like for the plug-in to restore the buffer to be the editable on-file one, instead of the historical view, when I dismiss the blame sidebar.

Actual behavior

See description.

Minimal config

for name, url in pairs{
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
} do
local install_path = vim.fn.fnamemodify('gitsigns_issue/'..name, ':p')
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
end
vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
}

-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

  1. mkdir gitsigns_issue
  2. cd gitsigns_issue
  3. git init
  4. printf '1\n2\n3\n4\n5' > file
  5. git add file
  6. git commit -m 'initial commit'
  7. printf '10\n20\n3\n4\n5' > file
  8. git add file
  9. git commit -m 'second commit'
  10. Open file, blame it and re-blame at the parent.
  11. Close the blame sidebar (e.g: C-w q).

Gitsigns debug messages

No response

Gitsigns cache

No response

lewis6991 commented 3 months ago

You need to navigate to the buffer you want manually. e.g. with :ls and :b<n>.