2

I've set switchbuf to vsplit but when I use :sbr, vim uses a horizontal split to open the new buffer. This seems directly contrary to what :help sbr says:

:sbr[ewind] [+cmd]
    Split window and go to first buffer in buffer list.  If the
    buffer list is empty, go to the first unlisted buffer.
    Respects the 'switchbuf' option.

And :help switchbuf says:

   split    If included, split the current window before loading
        a buffer for a |quickfix| command that display errors.
        Otherwise: do not split, use current window.
   vsplit   Just like "split" but split vertically.

The output of :version (I'm using Ubuntu 16.04's vim-gtk3-py2):

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056

I know about :vert sbr, and I can make an alias to make that more convenient, but I'd really like to figure out what's causing switchbuf to not work as expected. Thanks!

  • What's the specific command you're using to set switchbuf and, perhaps more importantly, what's the output of :set switchbuf? immediately before using :sbr? – 8bittree Mar 1 '17 at 18:34
  • Although, given that my own testing shows that :set switchbuf=vsplit followed by :set switchbuf? prints vsplit, and following that with :sbr results in a horizontal split, I'm inclined to think you may have found a bug. Seems to ignore switchbuf=newtab as well. And :sbnext misbehaves in the same manner as :sbr. – 8bittree Mar 1 '17 at 18:40
  • 1
    I've tried both with set switchbuf=vsplit in .vimrc and with :set switchbuf and :setlocal switchbuf (didn't expect that one to work, but worth a shot); set switchbuf? gives switchbuf=vsplit right before :sbr, just as you said. – Haldean Brown Mar 1 '17 at 19:18
  • 1
    Alright then, to the mailing list I guess! I'll report back. – Haldean Brown Mar 1 '17 at 19:19
  • 1
    Phew, got through the moderation queue, the thread is groups.google.com/forum/#!topic/vim_dev/ORzFkptXfek – Haldean Brown Mar 1 '17 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.