How do I open the current file in a preview window at a specific pattern?
:pedit +/TODO %
When you need a second read-only view of the same file, opening more normal splits can disrupt your working layout.
:pedit +/TODO %
When you need a second read-only view of the same file, opening more normal splits can disrupt your working layout.
:arglocal
By default, Vim's argument list is global, so changing it in one window can unexpectedly affect another workflow in a different tab or split.
:setlocal winfixheight
Quickfix windows are easy to disturb when you open, close, or rebalance other splits.
:psearch /pattern/
When you need quick context from another file but do not want to disturb your current editing window, :psearch gives you a clean workflow.
buffers-windows #buffers #windows #preview-window #search #navigation
:set switchbuf+=uselast
When jumps open the target buffer in an unexpected split, context switching gets expensive.
:leftabove sbuffer #
If you often compare your current file against the previously visited buffer, replacing the current window is disruptive.
:windo setlocal scrollbind
When reviewing related files side by side, manually keeping splits aligned wastes attention.
:lvimgrep /\<TODO\>/gj **/* | lopen
If you want project-wide search results without polluting the global quickfix list, use a location list.
:set splitkeep=topline
When you open, close, or resize splits in long files, the visible window region can shift in ways that break your reading flow.
:keepalt edit path/to/file\<CR>
Experienced Vim workflows often depend on the alternate file (#) for fast toggling with , quick diffs, or two-file review loops.
:lvimgrep /TODO/j **/* | lopen\<CR>
When you are working in multiple windows, quickfix can become noisy because it is shared globally across the editor session.
:windo setlocal scrollbind cursorbind
When reviewing related files side by side, alignment drifts quickly if each window scrolls independently.
buffers-windows #buffers-windows #windows #scrolling #comparison
:set noequalalways
When you work with carefully sized splits, Vim's default behavior can feel disruptive: opening or closing a window triggers an automatic rebalance.
:keepalt sbuffer {bufnr}
The alternate-file register (#) is easy to disturb when jumping around buffers, and many advanced motions depend on it (, # expansions, quick two-file toggles).
:hide edit {file}<CR>
Normally, trying to :edit another file from a modified buffer triggers a warning and blocks the switch unless you save or force the command.
buffers-windows #buffers #windows #workflow #command-line #editing
:setlocal winfixheight winfixwidth
If you use a dedicated utility pane (logs, quick notes, REPL output), Vim's default equalization behavior can keep resizing it whenever other splits change.
:windo diffthis<CR>
If you already have several related files open in splits, enabling diff mode one window at a time is slow and error-prone.
buffers-windows #buffers-windows #diff #windows #ex-commands
:vnew | setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
For quick throwaway notes, command output cleanup, or temporary edits, a normal buffer is noisy: it appears in :ls, can prompt you to save, and may leave swap a
buffers-windows #buffers-windows #buffers #windows #scratch #workflow
:ptjump /{pattern}
When a symbol name is ambiguous, jumping directly with :tag can bounce you around the codebase and disrupt your working context.
navigation #navigation #tags #windows #code-navigation #command-line
:windo normal! @q
When you split a file into multiple windows or keep several related buffers visible, repeating the same small cleanup in each one can be tedious.
macros #macros #windows #normal-mode #ex-commands #automation