How do I configure Vim's completion menu to show a popup without auto-selecting the first candidate?
:set completeopt=menuone,noselect
By default, Vim's and completion can auto-insert the first match, or only show a menu when there are multiple matches.
category:
config
tags:
#config
#completion
#insert-mode
How do I open a file for reference in a dedicated preview window without disturbing my split layout?
Vim has a built-in preview window — a special window distinct from regular splits.
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#ex-commands
How do I access the last Ex command I ran?
The : register contains the last Ex command that was executed.
category:
registers
tags:
#registers
#ex-commands
How do I copy text to the system clipboard in Vim?
The "+y command yanks (copies) text into the system clipboard register, making it available to paste in other applications outside of Vim.
category:
registers
tags:
#registers
#yank
#editing
#normal-mode
How do I find where a Vim option or mapping was last set?
The :verbose prefix shows where an option was last set (which file, which line).
category:
command-line
tags:
#command-line
#config
#ex-commands
How do I paste text from outside Vim without messing up indentation?
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
category:
config
tags:
#config
#editing
#insert-mode
How do I swap two adjacent lines?
The ddp sequence swaps the current line with the line below it.
category:
editing
tags:
#editing
#normal-mode
How do I stage or undo individual Git hunks without leaving Vim?
The vim-gitgutter plugin shows Git diff markers in the sign column and provides powerful commands to stage, undo, and preview individual hunks directly from Vim
category:
plugins
tags:
#plugins
#gitgutter
#git
#staging
#diff
#workflow
How do I run an interactive git blame inside Vim?
The vim-fugitive plugin by Tim Pope provides a powerful interactive :Git blame that goes far beyond the basic command-line git blame.
category:
plugins
tags:
#plugins
#fugitive
#git
#blame
#history
How do I configure Vim's built-in auto-completion?
:set completeopt=menu,menuone,noselect
The completeopt option controls the behavior of the completion popup menu.
category:
config
tags:
#config
#completion
#ex-commands
How do I copy from the cursor to the end of the line?
The y$ command yanks (copies) text from the cursor position to the end of the line.
category:
editing
tags:
#editing
#normal-mode
How do I extend a visual selection to a search match?
Starting a search while in visual mode extends the selection to the search match.
category:
visual-mode
tags:
#visual-mode
#search
How do I jump to the start or end of the text I last yanked or changed?
The ` [ ` and ] ` marks automatically track the boundaries of the last changed or yanked text.
category:
navigation
tags:
#navigation
#marks
#normal-mode
How do I use a macro to generate a numbered list automatically?
By recording a macro that duplicates a line and increments its number, you can generate a numbered list of any length with a single replay command.
category:
macros
tags:
#macros
#editing
#normal-mode
#automation
#productivity
How do I record a macro to wrap each line in HTML tags?
qaI<li><Esc>A</li><Esc>jq
This macro wraps each line in tags by inserting the opening tag at the start and appending the closing tag at the end.
category:
macros
tags:
#macros
#editing
How do I change text from the cursor to the end of the line?
The C command deletes everything from the cursor position to the end of the line and places you in insert mode.
category:
editing
tags:
#editing
#normal-mode
#insert-mode
How do I add custom tab completion to my own Ex commands?
:command -complete=file -nargs=1 E edit <args>
When defining custom commands with :command, the -complete option adds tab completion for arguments.
category:
command-line
tags:
#command-line
#completion
#custom-command
#tab-complete
How do I append the current filename to a named register from Ex command-line?
:let @a .= expand('%:t') . "\n"
Named registers are not just for yanks and deletes.
category:
registers
tags:
#registers
#command-line
#automation
#editing
How do I jump between changed lines in a Git-tracked file in Vim?
The vim-gitgutter plugin shows Git diff markers in the sign column and provides ]c and [c mappings to jump between changed hunks — groups of added, modified,
category:
plugins
tags:
#plugins
#gitgutter
#git
#navigation
#diff
How do I swap two characters in Vim?
The xp command swaps the character under the cursor with the character to its right.
category:
editing
tags:
#editing
#normal-mode