Monday, October 22, 2012

Re: changing buffers on windows

On 23/10/12 04:58, Brandon Coleman wrote:
> What is the suggested way to switch a buffer in a window that is displayed, but not the current window, or windows in other tab pages?
>
> Brandon
>

To switch _to_ window n in the current tabpage, use Ctrl-W w (or :wincmd
w) with a count. For instance to go to the first window at top left:

1^Ww
(where ^W means "hit Ctrl-W) or
:1wincmd w

To switch to the window containing foobar.txt, if there is one, even in
a different tab, or open the file in a new (split) window if there is none:
- only this time:
:let save_swb = &swb
:set swb+=usetab
:sbuffer foobar.txt
:let &swb = save_swb
:unlet save_swb

- every time: add to your vimrc
set swb+=usetab

then switch buffers using
:sbuffer foobar.txt


See:
:help CTRL-W_w
:help :wincmd
:help 'switchbuf'


Best regards,
Tony.
--
A little inaccuracy sometimes saves tons of explanation.
-- H. H. Munroe

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: