sponsor Vim development Vim logo Vim Book Ad

FastFold : Speed up Vim by updating folds only when called-for

 script karma  Rating 28/10, Downloaded by 3642  Comments, bugs, improvements  Vim wiki

created by
Enno Nagel
script type
Automatic folds (that is, folds generated by a fold method other
than `manual`), bog down VIM noticeably in insert mode and are often
recomputed too early (for example, when inserting an opening fold marker
whose closing counterpart is yet missing.)

See http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
for a discussion.

With this plug-in, the folds in the currently edited buffer are updated by an
automatic fold method only

- when saving the buffer
- when closing or opening folds (zo, za, zc, etc...)
- when moving or operating fold-wise (zj,zk,[z,]z)
- when typing `zuz` in normal mode

and are kept as is otherwise (by keeping the fold method set to `manual`).

Each of the above triggers can be changed by in your `.vimrc` by changing
the values

  nmap zuz <Plug>(FastFoldUpdate)
  let g:fastfold_savehook = 1
  let g:fastfold_fold_command_suffixes =  ['x','X','a','A','o','O','c','C']
  let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk']

FastFold is developed at


where issues can be filed.
install details
Unzip FastFold.zip into  ~/.vim on Linux or %USERPROFILE%\vimfiles on Windows.

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
FastFold.zip 5.3 2021-03-04 7.0 Enno Nagel make work less and document better
FastFold.zip 5.2 2018-05-10 6.0 Enno Nagel permit enabling FastFold for faster foldmethods (that is, different from expression or syntax folding)
FastFold.zip 5.1 2016-06-13 7.0 Enno Nagel fix trifles
FastFold.zip 5.0 2016-04-25 7.0 Enno Nagel restore folds after diff
FastFold.zip 4.1 2016-04-06 7.0 Enno Nagel add help tags, bug fixes and small improvements
FastFold.zip 3.0 2015-06-10 7.0 Enno Nagel smaller, more robust and faster
FastFold.zip 2.0 2015-04-08 7.0 Enno Nagel Integrate movement commands. Clean up configuration options.
FastFold.zip 1.1 2015-03-08 7.0 Enno Nagel Leaner code. Give priority to buffer instead of window fold settings.
FastFold.zip 1.0 2015-02-04 5.7 Enno Nagel 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.
Vim at Github