Thursday, April 8, 2010

Re: switching to window, by buffer nr

On Apr 7, 3:16 pm, Christian Brabandt <cbli...@256bit.org> wrote:
> On Mi, 07 Apr 2010, viki wrote:
>
> > Screen is split into several windows. One of windows belongs
> > to buffer #1. Which command sequence takes me to window
> > that belongs to buffer #1, without changing window layout and without
> > changing filenames of any window ?
>
> exe "bufwinnr(1)" wincmd w
>
> instead of 1 insert your buffer number.
>

This will not work. wincmd w does the same thing as CTRL-W w, which
will jump to a specific WINDOW, in top-to-bottom, left-to-right order.
It does NOT jump to the window containing a specific BUFFER.

Instead, you should make use of the 'switchbuf' option (set to
"useopen") and the :sbuffer command, or simply use the :drop command.

See the :help on each topic:

:help 'switchbuf'
:help :sbuffer
:help :drop

--
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

To unsubscribe, reply using "remove me" as the subject.

No comments: