Close the next window in Vim

Since I have a vertical split, how can I close the left window when the cursor is in the right window? I know that I can go to the next window with Ctrl-w wand then close it, but there may be a faster way. Thanks

+4
source share
2 answers

:-qor :-q!must complete the task.

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 believe the previews windowabove should read previous window...

+8
source

If you have only two windows open, the key combination Ctrl-w o(or command :only) will close the next (and only the other) window.

Generally Ctrl-w ocloses all windows except the current window.

+3
source

Source: https://habr.com/ru/post/1658391/


All Articles