How do I copy lines to a different location in the file without overwriting my yank register?
:t
The :t command (short for :copy) copies addressed lines to a destination line number, leaving the unnamed register untouched.
953 results for ":normal"
:t
The :t command (short for :copy) copies addressed lines to a destination line number, leaving the unnamed register untouched.
das
Vim defines a sentence as text ending with .
editing #editing #text-objects #delete #normal-mode #motions
:let @q .= "keys"
The string concatenation assignment :let @q .
vim.lsp.buf.code_action({ apply = true, filter = function(a) return a.isPreferred end })
When an LSP server marks a code action as isPreferred (e.
qama{edits}'aq
How it works When a macro needs to jump to different parts of the file and then return to a starting position, marks are the perfect tool.
qa{edits}@bq
How it works Vim macros can call other macros, creating a modular system of reusable building blocks.
<C-a> / <C-x> (vim-speeddating)
vim-speeddating (by Tim Pope) extends Vim's built-in and increment/decrement operators to understand dates, times, roman numerals, and other ordered sequences.
qqq qq{commands}@qq @q
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).
:jumps
How it works Vim keeps a jump list that records your cursor position every time you make a jump.
[I
How it works The [I command searches the current file (and included files) for the word under the cursor and displays a list of all matching lines with their li
:echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
When syntax highlighting looks wrong or a colorscheme override isn't taking effect, you need to know exactly which highlight groups are active under the cursor.
z<CR> and z. and z-
Vim has two sets of scroll-and-position commands: zt/zz/zb (which reposition the screen but keep the cursor column intact) and z/z.
]s and [s
How it works When spell checking is enabled in Vim with :set spell, misspelled words are highlighted.
:[range]yank {reg}
Vim's :[range]yank and :[range]delete Ex commands let you capture arbitrary line ranges into a register from the command line, bypassing the need to move the cu
z<CR> and zt
Both zt and z scroll the view so that the current line lands at the top of the screen, but they differ in one small but important way: z also moves the cursor t
as and is
Vim defines sentence text objects — as (around sentence) and is (inner sentence) — that allow any operator to act on an entire sentence in one motion.
~
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
]] / [[
The ]] and [[ commands let you jump forward and backward between section boundaries, which in most programming languages correspond to function or method defini
navigation #navigation #motions #normal-mode #code #functions
:g/pattern1/s/pattern2/replacement/g
Combining :g with :s lets you apply a substitution using two independent patterns: :g selects which lines to act on, and :s controls what gets replaced within t
:g/\(.\+\)\n\1/d
The :g command with a backreference pattern can detect and delete consecutive duplicate lines in one pass.