How do I delete an entire paragraph?
dip
The dip command deletes the inner paragraph — all contiguous non-blank lines surrounding the cursor.
dip
The dip command deletes the inner paragraph — all contiguous non-blank lines surrounding the cursor.
:t {line-number}
The :t (copy/transfer) command duplicates the current line and places it after the specified line number.
<C-x>
The command decrements the number under or after the cursor by 1.
ce
The ce command changes from the cursor position to the end of the current word.
==
The == command auto-indents the current line based on the surrounding context.
cc
The cc command deletes the entire content of the current line (preserving indentation) and enters insert mode.
:%normal command
The :normal command executes normal mode commands programmatically on a range of lines.
:%s/\(group\)/\1/g
Capture groups in Vim substitute let you match parts of a pattern and reuse them in the replacement.
:%s/pattern/\r/g
In the replacement part of :s, \r inserts a newline.
:%s/\(\w\+\)/\u\1/g
Vim provides case-conversion atoms in substitute replacements: \u uppercases the next character, \l lowercases it, \U uppercases until \e, and \L lowercases unt
:[{,]}s/old/new/g
By using the range [{,]}, you can limit a substitute command to the lines between the enclosing braces — effectively the current function or block.
:cdo s/old/new/g
The :cdo command executes a command on every entry in the quickfix list.
]c
In diff mode, ]c jumps to the next change hunk and [c jumps to the previous one.
highlight TrailingWhitespace ctermbg=red and match TrailingWhitespace /\s\+$/
How it works Vim's highlight and match commands let you create custom visual indicators.
set statusline=%{MyCustomFunc()}
How it works Vim's statusline supports the %{expr} syntax which evaluates a Vimscript expression and displays the result.
<C-v>jj"ay then "ap
How it works Vim registers remember not just the text content but also the type of selection that was used to yank it: characterwise, linewise, or blockwise.
:call setreg('a', @a . 'text', 'l')
How it works Vim provides two functions for advanced register manipulation: setreg() and getreg().
:%s/pattern/\=@a/g
How it works In Vim's substitute command, the replacement string can be a Vimscript expression when prefixed with \=.
:@a
How it works The command :@a executes the contents of register a as an Ex command.
try | colorscheme gruvbox | catch | colorscheme default | endtry
How it works When you share your vimrc across multiple machines, a colorscheme you have installed on one system may not exist on another.