How do I close a buffer without closing the window?
:bp | bd #
The :bp bd # command switches to the previous buffer and then deletes the alternate buffer.
:bp | bd #
The :bp bd # command switches to the previous buffer and then deletes the alternate buffer.
:set scrollbind
The scrollbind option locks the scrolling of two or more windows together so they scroll in unison.
<C-w>]
The ] command opens the definition of the tag under the cursor in a new horizontal split.
let g:netrw_liststyle=3 and let g:netrw_banner=0
How it works Vim ships with a built-in file explorer called netrw that you can access with :Explore (or :Ex).
:set splitbelow splitright
How it works By default, Vim opens horizontal splits (:split or :sp) above the current window and vertical splits (:vsplit or :vsp) to the left.
:set winfixwidth winfixheight
How it works When you open new split windows in Vim, the existing windows automatically resize to make room.
do (diffget) / dp (diffput)
How it works When you open two files in diff mode (using vim -d file1 file2 or :windo diffthis), Vim highlights the differences between them.
<C-w>}
How it works The } command opens a preview window showing the tag definition of the word under your cursor.
<C-w>f
How it works You may already know that gf opens the file path under the cursor in the current window.
<C-w>x
How it works The x command exchanges the current window with the next one.
<C-w>h / <C-w>j / <C-w>k / <C-w>l
How it works Vim lets you navigate between split windows using followed by a direction key.
:windo / :bufdo / :tabdo {command}
Vim's do commands iterate over collections and execute a command in each context.
buffers-windows #buffers #windows #tabs #batch-editing #ex-commands
:resize N / :vertical resize N
The :resize and :vertical resize commands set a window to an exact number of lines or columns.
:tabnew | lcd /path/to/project
Vim's :lcd (local change directory) sets the working directory per window.
buffers-windows #buffers #windows #tabs #workflow #project-management
<C-w>| and <C-w>_ / <C-w>=
Vim lets you temporarily maximize a split window to full width or full height, and then restore all windows to equal sizes with =.
buffers-windows #windows #splits #navigation #productivity #layout
:tabnew / gt / gT
Vim's tab pages let you organize your workspace into separate views, each containing its own window layout.
buffers-windows #buffers #windows #tabs #navigation #productivity
<C-^>
Pressing (Ctrl-6 on most keyboards) instantly toggles between the current buffer and the alternate file — the last file you were editing.
buffers-windows #navigation #buffers #normal-mode #productivity #windows
:windo set scrollbind
The scrollbind option locks two or more windows together so that scrolling in one window automatically scrolls the others by the same amount.
buffers-windows #windows #navigation #splits #diff #productivity
<C-w>H / <C-w>J / <C-w>K / <C-w>L
The H, J, K, and L commands move the current window to the far left, bottom, top, or right of the screen respectively, rearranging your entire split layout.
buffers-windows #windows #buffers #navigation #splits #layout
:mksession / :source Session.vim
Vim's session feature saves a snapshot of your entire workspace — open buffers, window layout, tab pages, current directory, and more — to a file that you c
buffers-windows #buffers #windows #config #productivity #workflow #session