Fast 'Find in Files' for VIM?
Asked Answered
M

6

20

What are some options for getting really fast 'Find in Files' searching in VIM?

Our codebase is large enough that searching needs to work off an index. grep/vimgrep/etc are too slow.

Indexing doesn't need to be particularly fast; I can index overnight.

Thanks,

[EDIT] I'm also working in a Windows environment.

Marshallmarshallese answered 7/7, 2009 at 23:10 Comment(0)
B
10

If it's source code (rather than full text search), then ctags with the TagList plugin should work well for your needs. See, for example:

http://www.thegeekstuff.com/2009/04/ctags-taglist-vi-vim-editor-as-sourece-code-browser/

EDIT: TagList and ctags will work on Windows as well (that's what I use). See the TagList install page and FAQ. The following links might prove useful:

There's also a TagList forum where you can get further help:

http://tech.groups.yahoo.com/group/taglist/

I set it up on my windows machine a while back, but I don't remember encountering any problems.

Barmy answered 7/7, 2009 at 23:16 Comment(0)
H
5

Something that I use, but not through vim, is ack: http://betterthangrep.com/

It is a perl based tool, and it should be usable in Windows.

Hillary answered 9/7, 2009 at 12:28 Comment(1)
This works very well for me. We have thousands of files, and a normal grep (or even ack) can take tens of seconds. But something like :Ack --ruby *something* will generally return in a second or two, since it is searching only a subset of filesTitanesque
I
4

If you're working with a large codebase, then it might be time to look for a more powerful solution than conventional tools. OpenGrok is a very fast source code search and cross-reference engine. On top of its great performance, it integrates with Subversion, Mercurial, and ClearCase, among other source revision control software. It sounds a lot like something you could use.

If you want support to use OpenGrok from within Vim, you could easily write a vim function that would call system() to start the search for you. To read more about writing new vim commands, look up :help 40.2 within vim.

I hope that's what you were looking for.

Institute answered 7/7, 2009 at 23:35 Comment(0)
C
1

I don't know how I found this, but looks like someone has written a plugin for google desktop

Chromolithograph answered 7/7, 2009 at 23:18 Comment(0)
G
0

Try to install https://github.com/mileszs/ack.vim, http://beyondgrep.com/ ,

then make a link

ln -s /usr/bin/ack-grep /usr/bin/ack 

and add

noremap <C-f> :copen<CR>:Ack -aQi --ignore-dir someignoringdir

to your .vimrc, after you can find in files through Ctrl+F, enjoy

_   /|
\'o.O'
=(___)=
   U  
Gardas answered 4/9, 2013 at 7:34 Comment(1)
Not sure if this will be faster than builtin grep or vimgrep.Sullivan
G
-1

You can try this

:vimgrep /something/ */

and dont forget to open search result window after

:cw

Gardas answered 24/5, 2013 at 7:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.