This worked for me:
:! grep manual `sed -n 's/^\. \(.*\)/\1/p' %` The sed part looks for source files and gives them as arguments to grep.
To avoid having to type this everytime you can create a command like this:
:command! -nargs=1 SourceGrep :! grep <args> `sed -n 's/^\. \(.*\)/\1/p' %` Be careful when searching for more than one word, you'll have to use quotes. For example:
:SourceGrep "sudo ssh" EDIT:
To search for lines with 'source' as well as '.':
:! grep manual `sed -rn 's/^(\.|source) (.*)/\2/p' %` The command will look like this:
:command! -nargs=1 SourceGrep :! grep <args> `sed -rn 's/^(source|\.) (.*)/\2/p' %`