jlanzarotta / bufexplorer

BufExplorer Plugin for Vim
BSD 3-Clause "New" or "Revised" License
510 stars 97 forks source link

Support toggle for vertical/horizontal splits #106

Open benthorner opened 2 years ago

benthorner commented 2 years ago

Would be great to have this kind of functionality as part of the plugin e.g. ToggleBufExplorerVerticalSplit. I made a quick function to do it, but it's hacky because I couldn't reuse the local variables and functions in the plugin itself.

function! CustomToggleBufExplorer()
    if bufname(winbufnr(0)) == '[BufExplorer]'
        execute 'bd'
    else
        call BufExplorerVerticalSplit()
    endif
endfunction

I'm a fan of vertical splits over replacing the current buffer e.g. with NERDTree. Using a toggle command like this makes it so much smoother to open and close a vertical (or horizontal) split over separate key mapping for each operation.

(Super plugin by the way 💯. I've been using it constantly for many years 🎉.)

clinkzlol commented 1 year ago

Same need : D I just add another ToggleBufExplorerVertical() to do that~