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.
: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.
:argdo update
When working through an argument list, many files may remain unchanged.
command-line #command-line #buffers #ex-commands #refactoring
: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.
:ldo s/foo/bar/ge | update\<CR>
:ldo is one of the most effective ways to perform targeted, multi-file edits without touching unrelated text.
: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.
:Gedit HEAD~1:%
When you are deep in a refactor, you often need to compare the current buffer with an older version of the same file.
:e archive.tar::path/to/file
Vim's built-in tar.
: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).
:keepalt edit {file}<CR>
The alternate-file mark (#) powers fast toggles like and commands that depend on the previous file context.
command-line #command-line #buffers #workflow #navigation #advanced
: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.
:argdo %s/\<old\>/new/ge | update
When you need to apply the same substitution across a curated set of files, :argdo is safer than a broad project-wide command.
command-line #command-line #ex-commands #search #buffers #formatting