foldsearch 2209

foldsearch is a Vim plugin that provides commands that fold away lines that don't match a specific search pattern.

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!
send us
an update
GPL (GNU General Public License) 
3.0/5 5
Markus Braun
ROOT \ Text Editing&Processing \ Vim Plugins
foldsearch is a Vim plugin that 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()

About Vim:

Vim is a text editor first released by Bram Moolenaar in 1991 for the Amiga computer. Vim was created as an extended version of the vi editor, with many additional features designed to be helpful in editing program source code; its full name is Vi IMproved.

While Vim is cross-platform, it is most popular on Unix-like operating systems.

Released under a software license compatible with the GNU General Public License, Vim is free and open source software. The program's license includes some charityware clauses.

Like vi, Vim's interface is based not on menus or icons but on commands given in a text user interface; its GUI mode, gVim, adds menus and toolbars for commonly used commands but the full functionality is still expressed through its command line mode.

For many users learning Vim may be slow initially, but once the basics are understood they progress quickly. To facilitate this, Vim has a built-in tutorial for beginners. There is also the Vim Users' Manual that details the basic and more advanced Vim features. This manual can be read from within Vim, or found online.

Vim also has a built-in help facility (using the :help command) that allows users to query and navigate through commands and features.


· Vim


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.

Last updated on July 18th, 2008

#vim plugin #line folder #code folder #Vim #code #line #folder

Add your review!