How do I copy a line to another location without using yank and paste?
:t {address}
How it works The :t command (short for :copy) copies one or more lines and places them below the specified address.
2277 results for "@a"
:t {address}
How it works The :t command (short for :copy) copies one or more lines and places them below the specified address.
:g/pattern/t$
How it works The :g (global) command combined with :t (copy) lets you duplicate all lines matching a pattern to a specific location.
<C-r>=strftime('%Y-%m-%d')<CR>
The expression register ("=) lets you evaluate any Vimscript expression and insert its result inline.
registers #registers #insert-mode #expression-register #dates
:set softtabstop=4
When expandtab is enabled, Vim inserts spaces instead of a real tab character, but without softtabstop, Backspace only deletes one space at a time — not a ful
:'<,'>right {width}
The :right Ex command right-aligns lines within a given column width by padding them with spaces on the left.
visual-mode #visual-mode #formatting #ex-commands #alignment
%:r
The %:r expression expands to the current filename with its extension removed (the "root" of the filename).
:tjump
:tjump {identifier} is the smart tag-jumping command: it jumps directly when there is only one matching tag, but shows an interactive numbered list when multipl
:lvimgrep /pattern/gj **/*.js | lopen
When you already rely on the global quickfix list for compiler errors or another search, running :vimgrep can wipe that context.
42G
The 42G command jumps the cursor directly to line 42 in the current file.
zug
When spell checking is active, pressing zg over a word adds it to your personal word list so Vim stops flagging it.
:Gdiffsplit
The vim-fugitive plugin provides :Gdiffsplit (and its vertical variant :Gvdiffsplit) to open a side-by-side diff view comparing the working tree version of a fi
:%s/\v(\d+)/\=printf('%04d', submatch(1))/g
When you need stable-width numeric fields, manual edits are slow and error-prone.
command-line #command-line #substitution #regex #refactoring
:%s/pattern//gn
The :%s/pattern//gn command counts how many times a pattern appears in the file without making any changes.
m<
Vim's ' marks record the start and end of the last visual selection and power the ' range used by Ex commands.
:lgetexpr systemlist('rg --vimgrep TODO %') | lopen
When you want search results tied to only the current window, use :lgetexpr instead of :cgetexpr.
buffers-windows #location-list #quickfix #buffers #command-line #search
:find filename
The :find command searches for a file by name across all directories in your path setting and opens it.
buffers-windows #buffers #file-management #navigation #workflow
:'<,'>copy'>
How it works The :copy command (or its abbreviation :t) duplicates lines to a specified destination.
:%sort /[^,]*,/ n
Vim's :sort command accepts a pattern that controls which part of each line is used as the sort key.
:%s/\%Vpattern/replacement/g
The \%V atom restricts a regex match to the last visual selection — more precisely than :'s/.
:%s/\n\{3,}/\r\r/g
When files pass through formatters, generators, or repeated edits, they often accumulate noisy vertical gaps.