Thursday, April 8, 2010

Re: switching to window, by buffer nr

On Apr 8, 9:20 am, "Christian Brabandt" <cbli...@256bit.org> wrote:
> On Thu, April 8, 2010 4:14 pm, Ben Fritz wrote:
> > On Apr 7, 3:16 pm, Christian Brabandt <cbli...@256bit.org> wrote:
> >> exe "bufwinnr(1)" wincmd w
>
> > 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.
>
> Yes it does. There is even an example in the help.
> See :h winc
>

From :help :winc :

The count can also be a window number. Example:
:exe nr . "wincmd w"
This goes to window "nr".

I assume this is the example to which you refer.

Note the difference between WINDOW nr, and BUFFER nr.

The OP may have a situation like this:

+-------------------------------------+
| | | |
| Window 1 | Window 2 | Window 3 |
| | | |
| Buffer 2 | Buffer 4 | Buffer 1 |
| | | |
+-------------------------------------+

Executing :2wincmd w will take you to Window 2, which is displaying
Buffer 4. IIUC, the OP said he wants to jump to the window containing
BUFFER 2 in this situation, which would be Window 1.

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