tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
19.82k stars 1k forks source link

:Gedit and similar commands spawn non-persistent buffers #2296

Closed hood closed 4 months ago

hood commented 4 months ago

Every time I try to open a past revision of a file, with something like:

:Gedit HEAD~4:%

A new buffer is open with -following this example- the current file at the indicated revision as expected, but as soon as I navigate away from that buffer, it vanishes. The only way for me to get back to it is by navigating to it using the jumplist, but it’s not persisted as the content of a buffer.

https://github.com/tpope/vim-fugitive/assets/56588510/6dcea009-00bf-4bf4-8651-c87e774a3026

As the video shows, I’m opening a previous revision of the file I’m currently working on, then moving to the tab to the left, making the newly opened buffer disappear.

hood commented 4 months ago

UPDATE: probably solved this by setting

autocmd User FugitiveObject setlocal bufhidden=
tpope commented 4 months ago

The reason it defaults to bufhidden=delete is that multiple people complained about the default behavior. Sounded like a personal problem to me, but ultimately, I gave the people what they wanted.