How do I suppress the 'Pattern not found' error when a substitution has no match?
:s/pattern/replacement/e
The e flag in Vim's :substitute command silently ignores the "E486: Pattern not found" error when the pattern does not match anything.
2125 results for "i{ a{"
:s/pattern/replacement/e
The e flag in Vim's :substitute command silently ignores the "E486: Pattern not found" error when the pattern does not match anything.
O (in blockwise visual mode)
In blockwise Visual mode (), pressing O moves the cursor to the diagonally opposite corner of the rectangle.
<Cmd>
The pseudo-key in Neovim allows a mapping to execute an Ex command directly, without going through command-line mode.
<C-f>
While typing in Vim's command line (after pressing :), pressing opens the command-line window with your current, unfinished command already filled in.
set winbar=%f
Neovim 0.
:lcd {dir}
:lcd (local cd) sets the working directory for the current window only, leaving other windows at their previous directory.
buffers-windows #buffers-windows #navigation #ex-commands #config
:set foldtext={expr}
The foldtext option controls what Vim displays for a closed fold.
:set grepprg={cmd} grepformat={fmt}
Vim's :grep command delegates to an external tool defined by grepprg, then parses the output according to grepformat to populate the quickfix list.
O (visual-block)
In Visual-Block mode (), pressing O moves the cursor to the diagonally opposite corner of the rectangular selection.
:set statuscolumn=%s%=%l\
Neovim 0.
config #config #neovim #statusline #line-numbers #formatting
y/{pattern}<CR>
Any operator in Vim can take a search motion as its argument.
8g8
The 8g8 command searches forward from the cursor for the first byte that belongs to an invalid UTF-8 sequence.
gd
The gd command jumps to the local definition of the word under the cursor.
:'<,'>!sort -t',' -k2 -n
Vim does not have a built-in multi-column sort, but you can leverage the external sort command to sort selected lines by any field.
editing #editing #sorting #ex-commands #external-commands #command-line
:%s//new/g
Leaving the search field empty in a :s command tells Vim to reuse the last search pattern from / or .
search #search #substitution #ex-commands #regex #productivity
:.!sh
The :.
command-line #editing #ex-commands #shell #filtering #productivity
:@q
Most macro workflows focus on @q, which replays register q as normal-mode keystrokes.
:s/pattern/\U&/g
Vim's :substitute command supports case-transformation escape sequences in the replacement string.
search #search #substitute #ex-commands #editing #text-objects
zH and zL
zH and zL scroll the viewport horizontally by half a screen width, letting you navigate wide content efficiently when wrap is disabled.
navigation #navigation #scrolling #horizontal #nowrap #motions
/\%Vpattern
The \%V atom restricts a search pattern to only match inside the most recent visual selection.