How do I apply commands to specific line ranges?
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
:set option
The :set command changes Vim options for the current session.
:silent command
The :silent prefix suppresses all output from a command, including messages and prompts.
:source %
The :source command reads and executes a Vimscript file.
:redir @a | command | redir END
The :redir command redirects Vim's command output to a register, file, or variable.
:execute "command"
The :execute command evaluates a string expression and runs it as an Ex command.
<C-f> from : prompt
Pressing while on the : command line opens the command-line window, where you can edit your command using full Vim editing capabilities.
:autocmd Event pattern command
Autocommands let you execute commands automatically in response to events like opening a file, saving, or changing buffers.
:%s/foo/bar/g | %s/baz/qux/g | w
The (bar) character in Vim's command line acts as a command separator, allowing you to chain multiple ex commands together on a single line.
:iabbrev teh the
Vim's abbreviation feature lets you define automatic text replacements that trigger as you type.
:!ls -la
Vim lets you execute any shell command directly from within the editor using the :! (bang) command.
:cabbrev
:cabbrev (command-line abbreviation) lets you define short aliases for longer Ex commands.
:verbose map <key> or :verbose set option?
The :verbose prefix shows where a mapping, setting, command, or function was defined — which file and line number.
command-line #command-line #debugging #config #mappings #workflow
:source % or :'<,'>source
The :source command executes Vimscript from a file.
command-line #command-line #vimscript #workflow #development
:{range}!command
The :{range}!command syntax pipes the specified lines through an external shell command and replaces them with the output.
command-line #command-line #shell #filtering #unix #ex-commands
q: or <C-f> from : prompt
The command-line window (q:) opens a full Vim buffer containing your Ex command history.
:g/pattern/cmd1 | cmd2
The :g (global) command can execute multiple Ex commands per matching line by chaining them with .
command-line #command-line #global #ex-commands #batch-editing #advanced
:term then <C-w>N for normal mode
Vim 8+ and Neovim have a built-in terminal emulator that runs inside a buffer.
command-line #command-line #terminal #workflow #productivity
:%sort u
The :sort u command sorts all lines in the file and removes duplicate lines in one operation.
command-line #command-line #ex-commands #editing #text-manipulation #sort
:%!python3 -m json.tool
The :%! command pipes the entire buffer through an external command and replaces it with the output.
command-line #command-line #shell #formatting #json #workflow