Thursday, April 8, 2010

Re: switching to window, by buffer nr

Hi Ben!

On Do, 08 Apr 2010, Ben Fritz wrote:

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

Quoting from :h bufwinnr()


bufwinnr({expr}) *bufwinnr()*
The result is a Number, which is the number of the first
window associated with buffer {expr}. For the use of {expr},
see |bufname()| above. If buffer {expr} doesn't exist or
there is no such window, -1 is returned. Example: >

echo "A window containing buffer 1 is " . (bufwinnr(1))

< The number can be used with |CTRL-W_w| and ":wincmd w"
|:wincmd|.
Only deals with the current tab page.

regards,
Christian

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