How do I specify line ranges in Ex commands to target specific parts of a file?
Every Ex command in Vim can be preceded by a range that specifies which lines it should operate on.
category:
command-line
tags:
#command-line
#ex-commands
#ranges
#editing
#productivity
How do you record a macro to convert tabs to spaces on each line?
Record a macro that substitutes all tabs with spaces on the current line, then moves down.
category:
macros
tags:
#macros
#tabs
#spaces
How do you create a numbered sequence using visual block mode?
Select a column of identical numbers with , then press g to create an incrementing sequence (1,2,3.
category:
visual-mode
tags:
#visual
#block
#sequence
How do I write a Vim plugin using the autoload directory structure?
The autoload mechanism in Vim lets you write plugins whose functions are only loaded into memory when they are first called.
category:
plugins
tags:
#plugins
#ex-commands
#editing
How do I edit a complex Ex command in a full editing window?
q: or <C-f> from : prompt
The command-line window (q:) opens a full Vim buffer containing your Ex command history.
category:
command-line
tags:
#command-line
#history
#editing
#workflow
How do I center or right-align text to a specific width in Vim?
Vim has built-in text alignment commands that adjust lines relative to a specified width.
category:
editing
tags:
#editing
#alignment
#formatting
#text
How do I paste the last Ex command I ran into my buffer?
The : register holds the most recently executed Ex command.
category:
registers
tags:
#registers
#ex-commands
#normal-mode
#productivity
How do you use a macro to prepend line numbers to each line?
Start at line 1, record a macro that inserts 1.
category:
macros
tags:
#macros
#line-numbers
#prepend
How do I search for text only within a visual selection?
The \%V atom restricts a search pattern to only match inside the most recent visual selection.
category:
search
tags:
#search
#visual-mode
#regex
#substitution
#advanced
How do I jump forward through the jump list after going back with Ctrl-O?
Every time you make a "jump" — using G, /, %, :tag, , or similar commands — Vim records your position in the jump list.
category:
navigation
tags:
#navigation
#normal-mode
How do I view or manipulate the search pattern register in Vim?
The / register holds the most recent search pattern.
category:
registers
tags:
#registers
#search
#pattern
#special-registers
How do I search for multiple alternative patterns at once in Vim?
Vim's search supports alternation with the \ operator, allowing you to find any one of several patterns in a single search.
category:
search
tags:
#search
#regex
#alternation
#patterns
How do I jump to any visible word or character on screen instantly in Vim?
The vim-easymotion plugin replaces Vim's default motion commands with a visual overlay system that lets you jump to any visible position on screen in just two o
category:
plugins
tags:
#plugins
#easymotion
#navigation
#motions
#jumping
How do I open a file explorer sidebar in Vim with NERDTree?
The NERDTree plugin provides a full-featured file explorer sidebar in Vim, giving you a visual directory tree that you can navigate, search, and manipulate file
category:
plugins
tags:
#plugins
#nerdtree
#files
#navigation
#explorer
How do I use Vim's built-in file explorer netrw to browse and manage files?
Netrw is Vim's built-in file explorer plugin that comes with every Vim installation.
category:
plugins
tags:
#plugins
#navigation
#buffers
How do I undo the last change in Vim?
The u command undoes the last change you made in normal mode.
category:
editing
tags:
#editing
#undo-redo
#normal-mode
How do I see a live preview of substitutions as I type in Neovim?
Neovim's inccommand option provides real-time visual feedback as you type substitution commands.
category:
visual-mode
tags:
#visual-mode
#substitute
#neovim
#preview
How do I run a normal mode command on every line in a range?
:{range}normal {commands}
The :normal command executes normal mode keystrokes from the command line.
category:
command-line
tags:
#command-line
#ex-commands
#editing
#normal-mode
How do I search and replace text across multiple files in Vim?
:args **/*.py | argdo %s/old/new/gc | update
Vim can perform search-and-replace across multiple files without any plugins by combining the arglist with :argdo.
category:
search
tags:
#search
#substitution
#ex-commands
#productivity
#quickfix
#arglist
How do I use normal regex syntax in Vim search without escaping everything?
Vim's default regex syntax requires backslashes before most special characters like +, (, ), {, and , which is the opposite of what most developers expect from
category:
search
tags:
#search
#regex
#ex-commands
#productivity
#patterns