How do I filter a visual selection through an external shell command?
Vim can pipe a visual selection through any shell command and replace the selection with the command's output.
category:
visual-mode
tags:
#visual-mode
#ex-commands
#external-commands
#filtering
How do I pass a range of lines through a shell command and replace them?
The :{range}!command syntax pipes the specified lines through an external shell command and replaces them with the output.
category:
command-line
tags:
#command-line
#shell
#filtering
#unix
#ex-commands
How do I collect all lines matching a pattern into a register?
The :g/pattern/y A command yanks every line matching the pattern and appends it to register a.
category:
command-line
tags:
#command-line
#registers
#global
#ex-commands
#filtering
How do I pipe selected text through an external command and replace it?
The ! operator in normal mode pipes text through an external shell command and replaces it with the output.
category:
command-line
tags:
#command-line
#shell
#editing
#filtering
#unix
How do I filter buffer contents through an external shell command?
The :%!{cmd} command pipes the entire buffer through an external shell command and replaces the buffer contents with the command's output.
category:
command-line
tags:
#editing
#ex-commands
#shell
#filtering
#productivity
How do I delete all lines that do NOT match a pattern?
The :v command (short for :vglobal) is the inverse of :g — it executes a command on every line that does not match the given pattern.
category:
command-line
tags:
#editing
#ex-commands
#search
#filtering
#productivity
How do I execute the current line as a shell command and insert the output?
The :.
category:
command-line
tags:
#editing
#ex-commands
#shell
#filtering
#productivity
How do I collect all lines matching a pattern and copy them to the end of the file or a register?
The :g command combined with yank A (uppercase A to append) lets you collect every line matching a pattern into a single register without overwriting previous c
category:
command-line
tags:
#editing
#ex-commands
#global-command
#registers
#filtering