Well, something 100% untested would be something like

:nnoremap <f8> :grep -r '<c-r><c-w>' *<cr>

The issue with this solution is that it "only does a plain grep" as I noted in my original mail. It will match the word against *any* appearance of it, for example if your cursor is on the word "approx" which is a function name in your C code then it will also match the word "approximation" in any of the comments. While the * command only matches words which are exactly "approx" and will not match "approximation". This is the behaviour I'm looking for accross multiple files.

Ah...try changing it to (again, 100% untested)

        :grep -r '<bslash><lt><c-r><c-w><bslash>>' *<cr>

(you might not have to escape those backslashes) Assuming the underlying grep mechanism supports it, it makes use of \<...\> to ensure word-boundaries. GNU grep seems to work with \<...\> but I don't know about any sort of internal greppage, or non-GNU grep versions.

        :help \<

Just another idea to try...

-tim

Reply via email to