Vim’s command line mode is as arcane as the rest of the editor.

Today I learned how to use the global command with normal mode

Use case:

I had a file with a few lines that were separated with a symbol: | Search Widget | Gboard | Talkback | Google Play Music | Mobile printing service

I wanted to deleted everything after the first “word”: the empty space, the | and everything else.

There are several ways to achieve this. But one is using a global command:

:g/ |/norm nD


:g         : Start a Global Command (:h :g for extra help on global commands)
/ |        : Search for empty space and |
/norm nD   : Execute nD in Normal Mode where
               n - jumps to the match
               D - delete to the end of the line

Now my file looks like this:

Further Reading