francoiscabrol/ranger.vim

"Overwrites" previous buffer when closing ranger without opening a file

Opened this issue ยท 12 comments

If you quit ranger without opening a file, jumping to the previous buffer (:b#<CR>) does not wor; it errors with:

E86: Buffer XX does not exist

I assume ranger creates a buffer, which is wiped on close. Do you have any idea how to fix this?

Yes it is exactly what happens... but I have no idea how to find a workaround. I use fzf to move between the buffers and I didn't see this issue.

Well i use fzf to move between buffers too! But i do use the previouis buffer command as well, just saying that :b# breaks after exiting ranger without opening a file.

Sorry, I can reproduce it but I don't see any workaround... It is a weird vim behaviour since if the buffer does not exists anymore, it should go to the previous existing one.
I can reproduce it only with Bclose and Neovim.

  • Open a terminal in nvim with :te
  • Then close it with :Bclose!
  • Then try :b#

@lohfu

I use fzf to move between the buffers
๐Ÿ˜ฎ how?

@mauroporrasp press Ctrl + B!

you need fzf set up... install fzf in your OS and add fzf vim to vim

EDIT: hmmm i realised Ctrl + B is not default keybinding in fzf... furthermore Ctrl + B is used by vim so you would be overriding a default keybinding.

@lohfu Any particular advantage over https://github.com/ctrlpvim/ctrlp.vim ?

@mauroporrasp

it's A LOT faster

I am experiencing the same problem, but in my case it only happens when I call Ranger from the first buffer. Otherwise, when I hit q I'm back to the original buffer.

I find this plugin is better for me https://github.com/rafaqz/ranger.vim

That last comment can be taken with a grain of salt.
It offers some functionality this one doesn't but it has the exact same problem with the alternate buffer, when using neovim, that is. When using regular Vim neither plugin has the problem, regarding this issue there is no difference.
The extra functionality it offers is in my opinion pretty useless, for the simple reason that as far as a quick look tells me, this is the sort of stuff for which one could better use vim-dirvish. Seeing who wrote that, you are going to have a hard time finding a better implementation.
Also, a fix for for the alternate file is on the horizon...

better for me

yeah yeah, but when you make that comment you are clearly encouraging others to use that one.
I believe they shouldn't for the reasons I've stated, and if not for those reasons, consider this:
instead if starting his own version he could have just contributed to this one, I guess he never saw Brian Lunduke talk about "Why Linux Sucks" (Check Youtube)