*:topleft* *E442*
:to[pleft] {cmd}
Execute {cmd}. If it contains a command that splits a window,
it will appear at the top and occupy the full width of the Vim
window. When the split is vertical the window appears at the
far left and occupies the full height of the Vim window.
Doesn't work for |:execute| and |:normal|.
*:bo* *:botright*
:bo[tright] {cmd}
Execute {cmd}. If it contains a command that splits a window,
it will appear at the bottom and occupy the full width of the
Vim window. When the split is vertical the window appears at
the far right and occupies the full height of the Vim window.
Doesn't work for |:execute| and |:normal|.
These command modifiers can be combined to make a vertically split window
occupy the full height. Example: >
:vertical topleft split tags
Opens a vertically split, full-height window on the "tags" file at the far
left of the Vim window.
------------------------------------------------------------------------------
Closing a window
:q[uit]
:{count}q[uit] *:count_quit*
CTRL-W q *CTRL-W_q*
CTRL-W CTRL-Q *CTRL-W_CTRL-Q*
Without {count}: Quit the current window. If {count} is
given quit the {count} window.
*edit-window*
When quitting the last edit window (not counting help or
preview windows), exit Vim.
When 'hidden' is set, and there is only one window for the
current buffer, it becomes hidden. When 'hidden' is not set,
and there is only one window for the current buffer, and the
buffer was changed, the command fails.
(Note: CTRL-Q does not work on all terminals).
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 fewer than 9 windows opened
:-quit " quit the previous window
:+quit " quit the next window
:+2quit " quit the second next window
<
When closing a help window, and this is not the only window,
Vim will try to restore the previous window layout, see
|:helpclose|.
:q[uit]!
:{count}q[uit]!
Without {count}: Quit the current window. If {count} is
given quit the {count} window
If this was the last window for a buffer, any changes to that
buffer are lost. When quitting the last window (not counting
help windows), exit Vim. The contents of the buffer are lost,
even when 'hidden' is set.
:clo[se][!]
:{count}clo[se][!]
CTRL-W c *CTRL-W_c* *:clo* *:close*
Without {count}: Close the current window. If given close the
{count} window.
When 'hidden' is set, or when the buffer was changed and the
[!] is used, the buffer becomes hidden (unless there is another
window editing it).
When there is only one |edit-window| in the current tab page
and there is another tab page, this closes the current tab
page. |tab-page|.
This command fails when: *E444*
- There is only one window on the screen.
- When 'hidden' is not set, [!] is not used, the buffer has
changes, and there is no other window on this buffer.
Changes to the buffer are not written and won't get lost, so
this is a "safe" command.
CTRL-W CTRL-C *CTRL-W_CTRL-C*
You might have expected that CTRL-W CTRL-C closes the current
window, but that does not work, because the CTRL-C cancels the
command.
*:hide*
:hid[e]
:{count}hid[e]
Without {count}: Quit the current window, unless it is the
last window on the screen.
If {count} is given quit the {count} window.
The buffer becomes hidden (unless there is another window
editing it or 'bufhidden' is `unload`, `delete` or `wipe`).
If the window is the last one in the current tab page the tab
page is closed. |tab-page|
The value of 'hidden' is irrelevant for this command.
Changes to the buffer are not written and won't get lost, so
this is a "safe" command.
:hid[e] {cmd} Execute {cmd} with 'hidden' set. The previous value of
'hidden' is restored