Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

vim

vi

What does pipe character do in vim command mode?

For example, :vimgrep /pattern/ file | copen

Does it act like a pipe in Linux Command Line? Contents of vimgrep gets piped to copen?

Or does it separate commands like ; in Command Line?

like image 528
bodacydo Avatar asked Oct 05 '15 08:10

bodacydo


1 Answers

| 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.

like image 163
Sagar Jain Avatar answered Oct 14 '22 08:10

Sagar Jain