How do I copy a specific line by number to after the current line?
:5t.
The :t ex command (also spelled :copy) copies a range of lines to a target address without touching any register.
Search Vim Tricks
Searching...:5t.
The :t ex command (also spelled :copy) copies a range of lines to a target address without touching any register.
:let @/ = @a
Vim's search register (@/) holds the current search pattern — the same one used by n, N, *, and hlsearch highlighting.
:'<,'>norm .
The :'norm .
visual-mode #visual-mode #editing #normal-mode #repeat #dot-operator
:g/pattern/Commentary
vim-commentary exposes Commentary as an Ex command that toggles comments on the current line, making it composable with Vim's :global command.
:Commands
fzf.
ysst
vim-surround's ysst sequence lets you wrap a text object with an arbitrary HTML or XML tag and prompts you to type the tag name.
:doautocmd FileType
When you change a buffer's filetype mid-session — say with :set filetype=python — Vim updates the filetype option but does not automatically re-run the File
:set complete-=i
Vim's complete option controls which sources are scanned when you press or to complete a word.
:[range]center {width}
Vim has a built-in :center command that pads lines with leading spaces to visually center them within a given column width.
command-line #formatting #text-alignment #ex-commands #editing
:DiffOrig
:DiffOrig opens a side-by-side split comparing your current (unsaved) buffer against the version on disk.
buffers-windows #diff #buffers #editing #workflow #buffers-windows
:Lexplore
:Lexplore opens Vim's built-in netrw file explorer as a persistent sidebar anchored to the left of the screen.
buffers-windows #netrw #file-explorer #buffers #windows #navigation
:set pastetoggle=<F2>
The pastetoggle option assigns a single key to toggle Vim's paste mode on and off without typing :set paste or :set nopaste every time.
z<CR>
While zt scrolls the current line to the top of the screen, z does the same scroll but also moves the cursor to the first non-blank character of that line.
gnn / grn / grm
nvim-treesitter's incremental selection module lets you grow and shrink your visual selection one syntax node at a time.
:Lazy profile
When Neovim starts slowly, finding the culprit plugin is tedious without tooling.
]c / [c (gitsigns.nvim)
gitsigns.
<C-x> / <C-v> / <C-t> (in Telescope)
When browsing results in a Telescope picker, you are not limited to opening selections in the current window.
:Oil
oil.
:set laststatus=3
Neovim 0.
:set fillchars+=vert:│,fold:·
The fillchars option controls the filler characters Vim uses for various UI elements — window separators, fold fill lines, diff padding, and more.