Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to have VIM do incremental search on text files?

Vim already does incremental search within the currently open file.

Examples of programs that demonstrate the type of search I'm trying to accomplish are Notational Velocity for MacOS, Resop for windows or SimpleNote for the web.

These apps do an instant or incremental search in the files of a specific directory and make it easy/fast to narrow down the file you are looking for or create a new file.
I use both but would rather live in one editor.(that being VIM)

Is there some plug in that would do this?

share|improve this question
    
Interested in GTD? Join Personal Productivity and Organization, we are looking for users & experts... :) –  Tom Wijsman Apr 10 '11 at 11:46
add comment

3 Answers

You could use the vimgrep command, e.g.:

:vimgrep /searchword/ ~/**

See

:help vimgrep

for details.

share|improve this answer
    
that doesn't do an instant search where you see results as you type (or am i wrong?) –  Alex Oct 8 '10 at 8:39
    
No, it doesn't. It wasn't clear that's what you wanted. (I'm not familiar with the software you mentioned, and "instant search" is rather vague.) –  frabjous Oct 8 '10 at 14:11
1  
i think the word I should have used was "incremental" instead of "instant" –  Alex Jan 13 '11 at 12:12
add comment

There's a nice plugin that does exactly that but with buffers: LustyExplorer.

There are also other plugins that do almost that with files: EasyGrep and Ack but neither do incremental search.

The first one (and others, and NV or Resoph Notes) can do incremental search because all the files are in memory, working like a database of sorts. It seems a little harder to implement on random files.

I'd really like to see such a functionnality in Vim because I just moved to Linux full time and there is no Notational Velocity replacement that I know of. NV was a central part of my workflow on Mac OS X and it's actually the only piece missing, right now. Drew Wagner's explanation of the problem and proposition for a solution seems interesting.

share|improve this answer
add comment

Not yet. Getting good incremental search performance would likely require someone to write a plugin in c that loads files into a big optimized data structure. There may be a way to hack vim to run grep over the whole database each time you hit a key, but that would probably not be fast enough.

For an example of an open source vim plugin that does incremental search (on filenames, not file contents unfortunately), you could look at the command-t plugin:

https://wincent.com/products/command-t

Another technical constraint that one might run into if one tries to load a whole database of notes into vim buffers is that each user is by default limited to 1024 simultaneously open files, and many note databases contain more notes than that. The limit can be lifted fairly easily, but users should not have to deal with such things.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.