4

Typing :buffers gives a list of loaded buffers. Can I switch to a viewport that views one of those buffers by name?

I know that :buffer NAME will load the named buffer in the current viewport. But I would rather type something like :viewport NAME and to have the cursor move to whatever viewport is currently viewing the named buffer, without changing which buffers are loaded. Is this possible?

9

You probably want to set the switchbuf option to "useopen" and then use :sbuffer NAME instead of :buffer to move your cursor to a window that has this buffer loaded.

See :help switchbuf for more information on valid values, this is definitely the setting that handles the behviour you want.

  • 1
    This works: :set switchbuf+=useopen followed by :sbuffer NAME. – Jasha May 3 '18 at 17:03

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.