Unload buffer [N] (default: current buffer) and delete it from the buffer list. If the buffer was changed, this fails, unless when [!] is specified, in which case changes are lost. The file remains unaffected.
:bd
Like |:bdelete|, but really delete the buffer.
:bw
Note
|
NOTE: a word of caution:
|
By default, Vim opens a new empty buffers when using the commands below, however,
if specifying <filename>
where filename
is the name of the file, it opens a new
buffer with the existing file. It <filename>
does not exist, it creates an empty file.
Note
|
|
:new <filename>
:enew <filename>
:vnew <filename>
:tabnew <filename>
Vim allows you to split buffers so you can easily work looking at multiple files. Vim allows the user to split the file vertically or horizontally. By default, Vim duplicates the current buffer if no filename or buffer is specified.
:vs <filename>
:vertical <filename>
:vsp <filename>
:sp <filename>
:split <filename>
Vim split height and resize ^^^^^^
Vim also allows you to specify a custom height for your buffer.
:10sp <filename>
:10vsp <filename>
To resize a current split, swap position, and move them to a tabview [[Vim tabs]], vim has a few key bindings to help out.
Shortcut | Action |
---|---|
ctrl+w _ |
Max out the height of the currents split |
ctrl+w | |
Max out the width of the current split |
ctrl+w = |
Normalize all split sizes (handy when resizing the terminal) |
ctrl+W R |
Swap top/bottom or left/right split |
ctrl+W T |
Break out current window into a new tabview |
ctrl+W o |
Close every window in the current tabview but the current one |