elihunter173/dirbuf.nvim

Feature: Preserve alternate buffer when entering/exiting directory buffer

elihunter173 opened this issue · 0 comments

This idea was initially suggested in a Reddit comment by u/llourenci

Dirvish has this nice feature where alternate buffers are preserved when using it to switch files. This allows you to switch between files you're working on more easily with Ctrl-^ (Ctrl-6). Dirbuf should do that too.

This is even more relevant now that Ctrl-^ and the alternate buffer are meaningless since we set bufhidden=wipe on directory buffers. (7cdcd19)

From an initial investigation into Dirvish's code, it uses altbuf and prevbuf and some :buffer work to set them up as necessary. We can probably mimick that though there might be a nicer/different way to do that with the Neovim API. We'll also have to be careful to make sure that chained directory buffers still allow you to go to the previous file you had open.