open command in a new window
[!TIP|label:reference:]
- windows.txt - new CTRL-W n CTRL-W_n CTRL-W CTRL-N CTRL-W_CTRL-N :[N]new [++opt] [+cmd] :new Create a new window and start editing an empty file in it. Make new window N high (default is to use half the existing height). Reduces the current window height to create room (and others, if the 'equalalways' option is set and 'eadirection' isn't "hor"). Also see ++opt and +cmd. If 'fileformats' is not empty, the first format given will be used for the new buffer. If 'fileformats' is empty, the 'fileformat' of the current buffer is used. This can be overridden with the ++opt argument. Autocommands are executed in this order:
" :[N]new [++opt] [+cmd] {file}
:<n>command +<command>
" | | + the command will be execute
" | + command to create new window. i.e.: new, vnew, split/sp, vsplit/vsp
" + line number or column number

move between windows
COMMANDS | SHORTCUT |
---|---|
:wincmd l |
ctrl + w ⇢ l |
:wincmd h |
ctrl + w ⇢ h |
:wincmd j |
ctrl + w ⇢ j |
:wincmd k |
ctrl + w ⇢ k |
:wincmd r |
ctrl + w ⇢ r |
resize
[!NOTE|label:reference:]
- Resize splits more quickly
- maximium split window: ctrl + w ⇢ _
- maximium vsplit window: ctrl + w ⇢ |
- resize window: ctrl + w ⇢ |
horizontal resize
:res
is the shortcut of:resize
COMMANDS OR SHORTCUT | COMMENTS |
---|---|
:res[ize] n |
setup the width to |
:res[ize] -n |
reduce |
:res[ize] +n |
extend |
ctrl + w ⇢ + | extend 1 line |
:wincmd + |
extend 1 line |
ctrl + w ⇢ - | reduce 1 line |
:wincmd - |
reduce 1 line |
ctrl + w ⇢ = | resize to default: 50% |
:wincmd = |
resize to default: 50% |
ctrl + w ⇢ _ | maximum the window |
:wincmd _ |
maximum the window |

vertical resize
COMMANDS OR SHORTCUT | COMMENTS |
---|---|
:vertical res[ize] n |
setup the width to |
:vertical res[ize] -n |
reduce |
:vertical res[ize] +n |
extend |
ctrl + w ⇢ > | extend 1 column |
:wincmd > |
extend 1 column |
ctrl + w ⇢ < | reduce 1 column |
:wincmd < |
reduce 1 column |
ctrl + w ⇢ = | resize to default: 50% |
:wincmd = |
resize to default: 50% |
ctrl + w ⇢ | | maximum the window |
:wincmd ⎮ |
maximum the window |

quickfix

- automatically fitting a quickfix window height
.vimrc au FileType qf call AdjustWindowHeight(3, 10) function! AdjustWindowHeight(minheight, maxheight) exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _" endfunction