I am looking for a way to grep the output of cscope queries from Vim.  
The following didn't work for me:
:cs f s symbol !grep pattern
It gave:
E259: no matches found for cscope query s symbol !grep pattern ...
P.S:
I know the redir method, I am looking for a simpler way to filter
output of ex command(s) through Unix commands.
You can use :redir to send message output to a register or file.
redir @c
cs f s symbol
redir END
Now you can put the c register into a file and filter it.
I don't get much output from cscope (it's all in the quickfix), but that will do what you're describing.
In general, you can filter shell commands (see :help :!cmd) with | (bar):
:!echo 0updateView | cscope -dl | grep global
But ex commands interpret bar as a command separator (so you can put multiple commands on one line):
:if &ft != 'help' | silent! cd %:p:h | endif
I don't think you can filter the output of ex commands aside from using redir. However, you could use Benoit's answer to filter the quickfix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With