cocopon / vaffle.vim

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

Open a file in a split #9

Closed cocopon closed 6 years ago

cocopon commented 7 years ago

Being able to open a file in a split and not replace the Vaffle window? https://github.com/cocopon/vaffle.vim/issues/6#issuecomment-325010237

cookiengineer commented 7 years ago

FWIW I kind of tried implementing the sidebar management on my own while managing the "buffer nr" of Vaffle in the same method.

The source is here: https://github.com/cookiengineer/.vim/blob/master/mappings.vim#L52 I bound it to the F1 key, because I'm never using the terminal help anyways :D

I used a similar way as when implementing a sidebar with NetRW. The difference of NetRW vs. Vaffle is mostly that netrw's default behaviour is that it will open a selected file in a new buffer, not in the same one.

The only missing part for making it work with Vaffle is being able to set something like the "target buffer nr" for Vaffle; so that the open action will lead to the buffer being opened in the given buf nr. and not being opened in its own buffer as it is doing currently. Alternatively when the default behaviour would be opening a new buffer, users would have to manage it manually (as with my example code).

cocopon commented 6 years ago

Implemented in #17.