How do I execute a single normal mode command without leaving insert mode?
Pressing while in insert mode drops you into a special "insert-normal" mode where you can execute exactly one normal mode command, then immediately return to in
category:
editing
tags:
#insert-mode
#normal-mode
#editing
#workflow
How do I run normal mode edits on every line matching a pattern?
The :global command combined with :normal lets you execute arbitrary normal mode keystrokes on every line that matches a pattern.
category:
command-line
tags:
#global
#normal-mode
#editing
#ex-commands
#batch-editing
How do I jump between method or function definitions in code?
When navigating large source files, ]m and [m let you jump directly to the start of the next or previous method.
category:
navigation
tags:
#navigation
#motions
#normal-mode
#editing
How do I run a single normal-mode command without leaving insert mode?
While typing in insert mode, you sometimes need to do a quick normal-mode action — center the screen, jump to a mark, or delete a word backward.
category:
editing
tags:
#insert-mode
#normal-mode
#editing
#motions
How do I create a custom operator that works with any motion in Vim?
:set operatorfunc=MyFunc<CR>g@{motion}
Vim's operatorfunc and g@ let you define custom operators that accept any motion or text object, just like built-in operators d, c, and y.
category:
config
tags:
#config
#mapping
#normal-mode
#editing
How do I scroll and copy text from a terminal buffer in Vim?
When using Vim's built-in :terminal, the buffer is in Terminal-Job mode by default, meaning all keystrokes go to the running shell.
category:
buffers-windows
tags:
#terminal
#buffers
#windows
#normal-mode
How do I make a macro run repeatedly until it reaches the end of the file or encounters an error?
A recursive macro is a macro that calls itself at the end of its recording.
category:
macros
tags:
#macros
#editing
#normal-mode
#registers
How do I increment or decrement hexadecimal and binary numbers with Ctrl-A and Ctrl-X?
By default, Vim's and only increment and decrement decimal numbers.
category:
config
tags:
#editing
#config
#normal-mode
How do I quickly convert between snake_case, camelCase, and other naming conventions in Vim?
Tim Pope's vim-abolish plugin provides cr (coerce) commands that instantly convert the word under the cursor between common naming conventions.
category:
plugins
tags:
#editing
#plugins
#formatting
#normal-mode
How do I reformat a paragraph to fit a specific line width in Vim?
The gq operator reformats text by wrapping lines to fit within the textwidth setting.
category:
editing
tags:
#formatting
#editing
#text-objects
#normal-mode
How do I look up documentation for the keyword under the cursor?
Pressing K in normal mode runs a lookup program on the word under the cursor.
category:
navigation
tags:
#navigation
#help
#documentation
#normal-mode
#keywordprg
How do I open the command-line window while typing a command on the : prompt?
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
category:
search
tags:
#command-line
#ex-commands
#editing
#normal-mode
How do I run normal mode commands on a range while ignoring custom mappings?
The :norm! (or :normal!) command executes normal mode keystrokes while ignoring all user-defined mappings.
category:
command-line
tags:
#ex-commands
#editing
#normal-mode
How do I maximize a window to full height or make all windows equal size?
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.
category:
buffers-windows
tags:
#windows
#buffers
#navigation
#normal-mode
How do I jump back to locations where I previously made edits?
Vim tracks every position where you made a change in the changelist.
category:
navigation
tags:
#navigation
#editing
#normal-mode
#motions
How do I make a macro repeat itself until it reaches the end of the file?
A recursive macro calls itself at the end of its recording, causing it to repeat automatically until a motion fails (like j at the last line).
category:
macros
tags:
#macros
#editing
#normal-mode
#registers
How do I move forward or backward by sentence in Vim?
The ) and ( motions move by sentence boundaries.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I select to the end of each line in visual block mode?
In visual block mode, pressing $ extends the selection to the end of every line, even when lines have different lengths.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I create an incrementing number sequence from identical numbers in Vim?
When you have multiple lines with the same number and want to turn them into a sequence (1, 2, 3.
category:
editing
tags:
#editing
#visual-mode
#normal-mode
How do I quickly toggle comments on lines of code in Vim?
The vim-commentary plugin by Tim Pope provides a simple, operator-based way to comment and uncomment code.
category:
plugins
tags:
#plugins
#editing
#normal-mode
#visual-mode