cocopon / vaffle.vim

:file_folder: Lightweight, window-based file manager for Vim
MIT License
284 stars 20 forks source link

Preserve alternate file #55

Closed WhoIsSethDaniel closed 4 years ago

WhoIsSethDaniel commented 4 years ago

This should resolve issue #49

nganhkhoa commented 4 years ago

Oh my god, I don't even know keepalt exists. Thanks.

cocopon commented 4 years ago

Could you tell me a test case to be fixed by this change? I tried a scenario below in main branch and it seems to be working fine without your change:

:e foo.txt
:e bar.txt
" Open Vaffle
:Vaffle
" show alternate file
:b#
" it should show bar.txt
WhoIsSethDaniel commented 4 years ago

If you, say, launch Vaffle and then go up a directory the alternate file becomes incorrect. E.g.:

:e alternate.file :Vaffle :ls!

  1 #    "alternate.file"               line 1
  2 %a-  "vaffle://0//home/seth/tmp"    line 1

h :ls!

 1      "alternate.file"               line 1
 2 %a-  "vaffle://1//home/seth"        line 6
 3u#    "vaffle://0//home/seth/tmp"    line 1

And now the alternate file is the previous directory you were viewing and not the file that was being edited prior to entering Vaffle. This is unintuitive and not in keeping with other, similar tools such as netrw or dirvish.

This PR preserves the most recently edited file as the alternate file.

cocopon commented 4 years ago

I understand, thank you for detailed explanation! Added a test case and merged.

WhoIsSethDaniel commented 4 years ago

Thank you for merging. I really like Vaffle!