What does pipe character do in vim command mode? (for example, :vimgrep /pattern/ file | another_cmd) What does pipe character do in vim command mode? (for example, :vimgrep /pattern/ file | another_cmd) linux linux

What does pipe character do in vim command mode? (for example, :vimgrep /pattern/ file | another_cmd)


| is used to execute more than one command at a time.

In your example:

:vimgrep /pattern/ file | copen

This finds for the pattern in the specified file and then opens a window to show current list of occurrence of pattern.

The second command (and subsequent commands) are only executed if the prior command succeeds.


To OP's question: the latter.

This is actually a vi feature, not vim-specific, used to separate multiple commands. It was answered before here: