PracticalVim Tip97 - yszheda/wiki GitHub Wiki

Tip 97: Meet the Global Command

Return to the top: <>

Format of `:global`:

References:

  • The default range for the `:global` command is the entire file (`%`).
* Most other Ex commands (`:delete`/`:substitute`/`:normal`): the current line (`.`) by default.
  • The `{pattern}` field integrates with search history → we can leave it blank and Vim will automatically use the current search pattern.
  • The `[cmd]` could be any Ex command except for another `:global` command.
* If we don't specify a `[cmd]`, then Vim will use `:print` by default.
  • `:global!`/`:vglobal`: invert the behavior of the `:global` command.
⚠️ **GitHub.com Fallback** ⚠️