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?


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

:vimgrep /searchword/ ~/**


:help vimgrep

for details.

  • 1
    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

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:


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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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