How do I save only a range of lines to a file?
:{range}w filename
The :w command with a range and filename saves only the specified lines to a new file.
:{range}w filename
The :w command with a range and filename saves only the specified lines to a new file.
:verbose set option?
The :verbose prefix shows where an option was last set (which file, which line).
:help topic
Vim has an extensive built-in help system.
:{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