How do I count the number of lines containing a pattern without making any replacements?
:%s/pattern//n
The n flag in the substitute command suppresses the actual replacement and instead reports the match count.
795 results for "g* g#"
:%s/pattern//n
The n flag in the substitute command suppresses the actual replacement and instead reports the match count.
gM
The gM command moves the cursor to the horizontal middle of the current line, regardless of how long the line is.
:s/\n/ /
One of the most confusing asymmetries in Vim's substitution syntax: \n and \r mean different things depending on whether they appear in the pattern or the repla
50%
Prefixing the % command with a count jumps the cursor to that percentage through the file.
:set equalprg={program}
The equalprg option replaces Vim's built-in = indentation operator with any external formatting program.
b: w: t: s:
Vimscript variables are prefixed with a one-letter scope identifier followed by a colon.
vim-startify plugin
vim-startify provides a configurable start screen when you open Vim without a file.
!{motion} {cmd}
The ! operator passes text selected by a motion through an external shell command, replacing it with the command's output.
<C-r>:
Vim stores your last executed Ex command in the read-only : register.
Plug 'vim-airline/vim-airline'
vim-airline provides a beautiful, feature-rich status line that shows file info, git branch, diagnostics, and more with minimal configuration.
:lockmarks
Many Ex commands silently adjust or delete marks as a side effect of modifying buffer content.
:cdo s/old/new/ | update
:cdo {cmd} executes a command at every entry in the quickfix list, visiting each location in turn.
g8
Pressing g8 in normal mode displays the UTF-8 encoding of the character under the cursor as a sequence of hex bytes.
<C-r>= (command-line mode)
Just like = lets you insert evaluated expressions in insert mode, you can use it inside an Ex command on the command line to embed any Vimscript expression resu
:%TOhtml
Vim ships with a built-in plugin that converts the current buffer into a standalone HTML file, complete with your exact syntax highlighting colors.
:earlier 10m
The :earlier command restores the buffer to its state at a specific time in the past.
vim-matchup
The vim-matchup plugin by Andy Massimino is a drop-in replacement for Vim's built-in matchit plugin that supercharges the % key to work with language-specific k
plugins #plugins #matchup #navigation #text-objects #matching
{count}go
The go command moves the cursor to a specific byte offset from the start of the buffer.
:Subvert
The vim-abolish plugin's :Subvert command (abbreviated :S) substitutes a word across all its case variants simultaneously.
<C-v>jj$A;
Visual block mode normally selects a fixed-width column, which makes appending tricky when lines have different lengths.