How do I move the current line or a visual selection up or down without cutting and pasting?
The [e and ]e mappings from Tim Pope's vim-unimpaired plugin exchange the current line (or a visual selection of lines) with the line above or below.
category:
plugins
tags:
#plugins
#editing
#motions
How do you record a macro to remove trailing whitespace from lines?
Record a macro that runs a substitution on the current line to remove trailing spaces, then moves down.
category:
macros
tags:
#macros
#trailing-whitespace
#cleanup
What is the difference between word and WORD motions in Vim?
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
category:
navigation
tags:
#navigation
#motions
#word
#word-motion
How do I land on a specific position relative to a search match?
Search offsets let you place the cursor at a specific position relative to the match.
category:
navigation
tags:
#navigation
#search
#normal-mode
How do I use case conversion metacharacters in Vim substitution replacement strings?
\U, \L, \u, \l, \e in :substitute replacement
Vim's substitute command supports in-replacement case conversion metacharacters that transform the case of matched text without extra scripting.
category:
search
tags:
#search
#ex-commands
#normal-mode
How do I scroll the screen down by one line without moving the cursor?
The command scrolls the window down one line at a time while keeping the cursor on its current line (until the cursor would go off-screen).
category:
navigation
tags:
#navigation
#scrolling
#normal-mode
How do I delete through the end of the next search match from the cursor?
When you need to remove text up to a known marker, a plain search motion is often almost right but stops at the start of the match.
category:
navigation
tags:
#navigation
#search
#motions
#editing
How do I change the cursor shape for different Vim modes in the terminal?
Modern terminals support cursor shape changes via escape sequences.
category:
config
tags:
#config
#cursor
#terminal
#visual-feedback
How do I open the directory containing the current file in netrw from within Vim?
The command :e %:h opens netrw (Vim's built-in file browser) in the directory that contains the current file.
category:
command-line
tags:
#command-line
#navigation
#buffers
#netrw
#editing
How do I open a file and jump directly to a specific line or pattern?
The :edit command accepts a +{cmd} prefix that executes an Ex command immediately after the file is loaded.
category:
command-line
tags:
#buffers
#ex-commands
#navigation
#command-line
How do I move the cursor just after each search match instead of at match start?
Most Vim searches place the cursor at the start of the match.
category:
search
tags:
#search
#patterns
#motions
#editing
How do I quickly switch between the current file and the last file I was editing?
:e # opens the alternate file — the file you were editing just before the current one.
category:
buffers-windows
tags:
#buffers
#editing
#ex-commands
#navigation
How do I open a file and immediately execute a command, like jumping to a pattern or line?
The :e +{cmd} {file} form opens a file and executes an Ex command immediately after loading it.
category:
command-line
tags:
#ex-commands
#buffers
#editing
How do I open a related file with a different extension using the current filename?
In Vim's command line, % expands to the current buffer's filename.
category:
command-line
tags:
#ex-commands
#command-line
#buffers
#navigation
How do I reopen the current file and force Vim to interpret it with a specific line ending format?
The ++ff modifier forces Vim to re-read the current file from disk using a specific fileformat — unix (LF), dos (CRLF), or mac (CR).
category:
editing
tags:
#ex-commands
#editing
#buffers
How do I quickly open my vimrc configuration file from anywhere in Vim?
The :e $MYVIMRC command opens your Vim or Neovim configuration file instantly, no matter where it lives.
category:
config
tags:
#config
#vimrc
#workflow
How do I use Git from within Vim with vim-fugitive?
:Git command (e.g., :Git status)
vim-fugitive by Tim Pope is a comprehensive Git wrapper for Vim.
category:
plugins
tags:
#plugins
#ex-commands
How do I strip trailing whitespace without clobbering my last search pattern?
:keeppatterns %s/\s\+$//e
Bulk cleanup commands often damage your navigation flow by overwriting the last search pattern (@/).
category:
command-line
tags:
#command-line
#search
#substitution
#whitespace
How do I reopen the current file with a different character encoding in Vim?
When Vim opens a file with the wrong encoding — producing garbled text or incorrect characters — you can reload it with a specific encoding using :e ++enc={
category:
editing
tags:
#editing
#encoding
#command-line
#file-handling
How do I suppress the 'Pattern not found' error when a substitution has no match?
The e flag in Vim's :substitute command silently ignores the "E486: Pattern not found" error when the pattern does not match anything.
category:
search
tags:
#search
#substitute
#ex-commands
#macros
#editing