Monday, March 9, 2015

Re: vim complete() with result from grep

On 2015-03-09, BaRud wrote:
> Hi,
>
> I am trying to create a function that will pop up a list of file
> includes the word "Module"(case insensitive).
>
> I tried :lvim /Module/gj *.f90 when all *.f90 is in current dir,
> but I failed to make a globpath() like expand so that I can
> include and subdirs.

I think this will do what you want, as far as building the location
list is concerned. No need for Python.

:lvim /Module\c/gj **/*.f90

In a function:

function foo(pattern)
lvim /Module\c/gj **/*.f90
endfunction

The "\c" will make the search case-insensitive and the "**" will
include the current directory and subdirectories.

:help :vimgrep
:help starstar-wildcard

From the "#!/usr/bin/python" line of you script, it looks like
you're using Unix. In that case, you might prefer to use grep,
which will be faster.

:lgrep -iR Module .

The trailing "." is not needed in some versions of grep.

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: