Tuesday, July 23, 2013

Re: How to close a window by window number?

On 2013-07-23, Eric Siegel wrote:
> Hi everyone,
>
> I'm attempting to write a small function that toggles a specific
> buffer. By toggle, I mean quits the window and then splits to
> reopen it. It is important that I quit the window and not delete
> the buffer.
>
> I can't seem to find a vim function that allows me to quit a
> specific window. I have both the buffer name and the window
> number.
>
> Do I need to iterate over all windows using "wincmd"?

If you have the window number in 'winnr', you can jump to it with

exe winnr . "wincmd w"

or maybe

exe winnr . "wincmd c"

to close it. I haven't tried the last. See

:help :wincmd

Regards,
Gary

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: