Vim Tips Wiki

Use this page to discuss script 2302 foldsearch: fold away lines that don't match a given pattern

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.


This is such a valuable script. Thank you Mr. Braun for contributing it! Once you have foldsearch, Vim supports searchable line-based tags right out of the box. For example, let's say I'm typing a variety of notes to myself like so:

#todo file taxes
#done water plants
#song Somewhere Over The Rainbow -- #music
#todo pick kids up from school -- #family
#todo explain why foldsearch.vim is so cool -- #vim #cs

Once I've loaded foldsearch.vim I can instantly see all the #todo items by typing ":Fp #todo<Enter>".

Whenever I'm on a new computer, the first thing I need is Vim so I can take notes. Whenever I'm on a new Vim environment, the first thing I do is install foldsearch.vim. --Ryan