18

I know it's possible to open a new file in a split, with :split or :vsplit, but is it possible to open a new split with an existing buffer, potentially leveraging autocomplete?

  • Have you ever tried :sp(lit) or :vs(plit) with no argument? :) – yo' Feb 3 '15 at 18:57
24

The sbuffer command will let you create a split with an existing buffer name or number. :sb# will open a split with buffer number # (as displayed in the :buffers list). :sb foo will open a split with the buffer named foo. Tab-complete will cycle the available buffer names.

You can use :vertical sb... if you want a vertical split instead of the default, horizontal, one.

  • Is there a less verbose way to open an existing buffer in a new vertical split? Something like :v sb maybe? – zepp.lee Apr 28 '18 at 13:52
  • 1
    I believe “vertical” can only be shortened to “vert” so if you want something more concise you’ll have to make a custom command/function/etc – Josh Apr 28 '18 at 14:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.