Close the next window in Vim

vim

Solution

`:-q` or `:-q!` should do the job.

According to `:h CTRL-W_q`:

:q[uit]
:{count}q[uit]
...
                If [count] is greater than the last window number the last
                window will be closed:
                    :1quit  " quit the first window
                    :$quit  " quit the last window
                    :9quit  " quit the last window
                            " if there are less than 9 windows opened
                    :-quit  " quit the previews window
                    :+quit  " quit the next window
                    :+2quit " quit the second next window

I presume `previews window` above should read `previous window`...

Problem

Since I have a vertical split, how can I close the left window while the cursor is on the right window? I know I can go to the next window with `Ctrl-w w` and then close it but there might be a faster way. Thanks

Original source