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
:lcd {dir}
:lcd (local cd) sets the working directory for the current window only, leaving other windows at their previous directory.
buffers-windows #buffers-windows #navigation #ex-commands #config
:e #
:e # opens the alternate file — the file you were editing just before the current one.
: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.
:bufdo
When you need to apply the same change to every file you have open in Vim, switching to each buffer manually is tedious and error-prone.
: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.
: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
:ls +
The :ls command (or :buffers) supports filter flags that narrow the buffer list to specific states.
<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
:autocmd WinResized * wincmd =
When you resize your terminal window, Vim's split layout can become unbalanced.
: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
:lua vim.api.nvim_open_win(0, true, {relative='editor', width=80, height=20, row=5, col=10})
Neovim's floating windows hover above the main layout, creating popup-like UI elements.
<C-w>z or :pclose
The preview window shows file contents temporarily without switching your editing context.
buffers-windows #buffers-windows #quickfix #preview #navigation
<C-w>R
Vim provides commands to rotate windows within a row or column, and to swap the current window with another.