How do I create custom fold regions with markers in my code?
:set foldmethod=marker
Setting foldmethod=marker lets you define fold boundaries using special comment markers — {{{ to start a fold and }}} to end it.
432 results for "visual mode"
:set foldmethod=marker
Setting foldmethod=marker lets you define fold boundaries using special comment markers — {{{ to start a fold and }}} to end it.
cx{motion} … cx{motion} (vim-exchange)
The vim-exchange plugin provides cx{motion} to mark a region, then cx{motion} again on a second region to swap them in place.
:GBrowse
The vim-fugitive plugin combined with vim-rhubarb (for GitHub support) provides the :GBrowse command, which opens the current file on your repository's web host
<C-a> / <C-x>
Pressing increments and decrements the number under or after the cursor.
gr{char}
The gr{char} command is Vim's virtual replace variant of r{char}.
:'<,'>normal A;
The :normal command executes normal-mode keystrokes on every line in a range.
command-line #command-line #ex-commands #editing #normal-mode #batch-editing
:[range]w !{cmd}
The :[range]w !{cmd} command writes a range of lines to the standard input of a shell command, leaving the buffer completely unchanged.
{count}J
The J command joins the current line with the line below, adding a space between them.
[/ and ]/
Vim provides two motions for navigating C-style block comments (/ .
:'a,'b s/old/new/g
Marks can be used as range specifiers in any Ex command.
command-line #marks #command-line #ex-commands #ranges #editing
\@=
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@ family of atoms.
dv{motion}
In operator-pending mode — after typing an operator like d, y, or c but before the motion — you can press v, V, or to override the motion type to characterw
zfap
Combining the fold-creation operator zf with the ap (around paragraph) text object gives you a quick way to collapse any paragraph into a single fold line.
&
The & command in normal mode repeats the last :s substitution on the current line.
search #search #substitution #ex-commands #repeat #normal-mode
:nnoremap / :inoremap / :vnoremap
Vim has two types of key mappings: recursive (:map, :nmap, :imap) and non-recursive (:noremap, :nnoremap, :inoremap).
:set operatorfunc=MyFunc<CR>g@{motion}
Vim's operatorfunc and g@ let you define custom operators that accept any motion or text object, just like built-in operators d, c, and y.
d3aw
Most Vim users know you can put a count before an operator (3dw) or use a text object once (daw).
editing #text-objects #editing #delete #normal-mode #motions
nnoremap <expr> j v:count == 0 ? 'gj' : 'j'
By default, j and k move by physical lines (newline-delimited), which jumps over the entire visual span of a long wrapped line in a single keystroke.
:'<,'>norm {commands}
The :normal (or :norm) command lets you execute normal mode keystrokes from the command line.
command-line #editing #ex-commands #normal-mode #productivity #ranges
:[range]normal @a
The :[range]normal @a command runs a recorded macro against every line in a given range.
macros #macros #registers #ex-commands #normal-mode #advanced