How do I run a Vim command and suppress all its output messages and error messages?
:silent!
The :silent! modifier runs an Ex command without displaying any output or error messages.
:silent!
The :silent! modifier runs an Ex command without displaying any output or error messages.
:g/^/t.
The command :g/^/t.
:set keywordprg
The K key in normal mode looks up the word under the cursor using the program defined by keywordprg.
:doautocmd
:doautocmd fires any autocommand event manually, exactly as if that event had occurred naturally.
q?
Vim provides three command-line history windows accessible from normal mode: q: for Ex commands, q/ for forward searches, and q? for backward searches.
<C-r><C-r>
In command-line mode, {reg} inserts a register's contents — but it processes certain sequences, potentially misinterpreting backslashes, pipe characters, or e
<C-v> (command-line mode)
In command-line mode (after : or /), pressing followed by any key inserts that key literally — bypassing all key notation, mappings, and special interpretatio
:sign define and :sign place
Vim's built-in sign system lets you define custom symbols and place them in the sign column — the narrow gutter to the left of line numbers.
<C-f> (in command-line mode)
When you're already on the Vim command line and realize you need complex edits — inserting text from multiple positions, reordering arguments, or referencing
<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
:lua =expr
In Neovim, prefixing a Lua expression with = on the :lua command line evaluates it and pretty-prints the result using vim.
:g/^\s*$/d
The global command :g/^\s$/d removes every line that is empty or contains only whitespace — a common cleanup task when tidying up code, configuration files, o
:set wildmode=list:longest
Vim's wildmode option controls how the command line behaves when you press to complete filenames, buffer names, or Ex commands.
%:e
Vim exposes the current filename as % in Ex commands, and you can apply modifiers to extract specific parts of the path.
:noautocmd {command}
The :noautocmd prefix (abbreviated :noa) suppresses all autocommand events for the duration of the following command.
command-line #ex-commands #autocommands #performance #command-line #scripting
:set wildcharm=<Tab>
The wildcharm option designates a key that, when it appears inside a mapping, triggers wildmenu completion on the command line — just as if you had pressed in
:let $VAR = "value"
Vim lets you read and write environment variables using the $VARIABLE syntax in Vimscript.
:g/pattern/+1d
Using :g/pattern/+1d you can delete the line that comes right after each line matching a pattern, in one pass.
5:
Typing a count before : in normal mode automatically fills in a line range in the command line.
command-line #command-line #ex-commands #ranges #normal-mode
expand('%:p:h:t')
Vim's filename modifiers can be chained to transform paths step by step.