How do I change the working directory for only the current window without affecting other windows or tabs?
:lcd
:cd changes the global working directory, affecting every window and tab in the session.
:lcd
:cd changes the global working directory, affecting every window and tab in the session.
:botright split
When you split a window with :split or :vsplit, Vim subdivides only the current window.
buffers-windows #buffers #windows #ex-commands #command-line
:tab split
:tab split opens the current buffer in a brand new tab page, giving you a second independent view of the same file.
dp / do
When reviewing differences between files in Vim's built-in diff mode, dp and do let you selectively apply individual hunks without leaving the editor.
<C-w>^
Vim tracks the alternate buffer — the last file you were editing before the current one.
:topleft split {file}
By default, Vim places horizontal splits below and vertical splits to the right (controlled by splitbelow and splitright).
:tab drop filename
When working with many tabs, you often want to open a file — but only if it is not already open somewhere.
:diffthis
You often have two files open side by side and want to compare them without leaving Vim or launching vimdiff.
:diffget / :diffput
When comparing two files side by side with :diffsplit or vim -d, you often want to pull specific changes from one file into another rather than accepting all di
:terminal ++curwin
By default, :terminal opens a new split window for the terminal emulator.
buffers-windows #terminal #buffers #windows #shell #ex-commands
dp and do
When comparing two files side by side in Vim's diff mode (:diffsplit or vim -d file1 file2), you often want to accept or push individual changes between the fil
<C-w>N
When using Vim's built-in :terminal, the buffer is in Terminal-Job mode by default, meaning all keystrokes go to the running shell.
:ptag function_name
The :ptag command opens a tag definition in a small preview window at the top of the screen, letting you read the definition without losing your place in the cu
buffers-windows #buffers #windows #tags #preview #navigation
:set winfixheight
When you have a specific window you want to keep at a fixed size — like a terminal, log viewer, or reference file — winfixheight and winfixwidth prevent Vim
<C-w>R
Vim provides commands to rotate windows within a row or column, and to swap the current window with another.
<C-w>_ and <C-w>|
When working with multiple splits, you sometimes need to focus on one window temporarily without closing the others.
<C-w>_ and <C-w>=
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.
:sb {buffer}
The :sb (short for :sbuffer) command opens a buffer that is already loaded in Vim in a new horizontal split window.
:tabedit
Vim's tab pages let you keep separate window layouts open at the same time, each with its own set of splits.
<C-w>+ / <C-w>- / <C-w>> / <C-w><
Vim provides keyboard shortcuts to resize split windows without reaching for the mouse.