sponsor Vim development Vim logo Vim Book Ad

foldsearch : fold away lines that don't match a given pattern

 script karma  Rating 106/37, Downloaded by 1380    Comments, bugs, improvements  Vim wiki

created by
Markus Braun
script type
This plugin provides commands that fold away lines that don't match a specific search pattern.  This pattern can be the word under the cursor, the last search pattern, a regular expression or spelling errors. There are also commands to change the context of the shown lines.


:Fw [context*]
  show lines which contain the word under the cursor. Default [context] is 0.

:Fs [context*]
  show lines which contain previous search pattern. Default [context] is 0.

:Fp pattern
  show the lines that contain the regular expression. Context is 0.

  show the lines that contain spelling errors.

  fold again with the last used pattern

:Fc [context*]
  show context lines.

  increment context by one line.

  decrement context by one line.

  set modified fold options to their previous value

* context can consist of one or two numbers. A 'unsigned' number defines the context before and after the pattern. If a number has a '-' prefix, it defines only the context before the pattern. If it has a '+' prefix, it defines only the context after a pattern.


<Leader>fs     FoldSearch()
<Leader>fw     FoldCword()
<Leader>fl     FoldLast()
<Leader>fS     FoldSpell()
<Leader>fi     FoldContextAdd(+1)
<Leader>fd     FoldContextAdd(-1)
<Leader>fe     FoldSearchEnd()
install details
Copy the foldsearch.vim file to the $HOME/.vim/plugin directory. Refer to ':help add-plugin', ':help add-global-plugin' and ':help runtimepath' for more details about Vim plugins.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
foldsearch.vim 2213 2008-07-26 7.0 Markus Braun - fixed a bug in context handling
foldsearch.vim 2209 2008-07-17 7.0 Markus Braun Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo