vim :global Basic usage of the Global Command


Example

:g/Hello/d

Will delete every line containing the text "Hello". Important note: This is not the normal mode command d, this is the ex command :d.

You can use the global command to apply normal mode keystrokes instead of ex commands by prepending normal or norm to the command. For example:

:g/Hello/norm dw

Will delete the first word from every line that contains the text "Hello".

The global command also supports visual mode and ranges.