Foldsearch is a Vim plugin with the ability to fold lines that do not match a certain search pattern by offering relevant commands.
Some of the commands you'll have at your disposal include :Fw [context*], which shows lines containing the word under the cursor, and :Fs [context*], which shows lines containing the previous search pattern. The :Fp pattern command will show the lines that contain a specific regular expression, whereas :FS will display the lines containing spelling errors. There is also the :Fl command which folds again with the last used pattern.
Other useful commands are :Fc [context*], which shows context lines, :Fi, which increments context by one line, and :Fd, which decrements context by one line. Moreover, there is the :Fe command, which sets modified fold options to their previous value.
Keep in mind that context can consist of one or two numbers. An 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.
Regarding mappings, foldsearch offers several key commands such as < Leader >fs for FoldSearch(), < Leader >fw for FoldCword(), < Leader >fl for FoldLast(), < Leader >fS for FoldSpell(), < Leader >fi for FoldContextAdd(+1), < Leader >fd for FoldContextAdd(-1), and < Leader >fe for FoldSearchEnd().
For those unfamiliar with Vim, it is a text editor that was 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.
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.
To use foldsearch, you'll need Vim installed. Installation is straightforward: just 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. Once installed, you'll have an efficient way to handle line folding while searching.
Version 2209: N/A