{"id":13649390,"url":"https://github.com/Konfekt/FastFold","last_synced_at":"2025-04-22T14:31:35.483Z","repository":{"id":18882098,"uuid":"22099584","full_name":"Konfekt/FastFold","owner":"Konfekt","description":"Speed up Vim by updating folds only when called-for.","archived":false,"fork":false,"pushed_at":"2024-12-15T07:22:32.000Z","size":152,"stargazers_count":708,"open_issues_count":11,"forks_count":23,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-20T10:10:11.704Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Konfekt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-07-22T10:13:33.000Z","updated_at":"2025-04-15T06:15:45.000Z","dependencies_parsed_at":"2024-01-23T07:49:30.677Z","dependency_job_id":null,"html_url":"https://github.com/Konfekt/FastFold","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konfekt%2FFastFold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konfekt%2FFastFold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konfekt%2FFastFold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konfekt%2FFastFold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Konfekt","download_url":"https://codeload.github.com/Konfekt/FastFold/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250258985,"owners_count":21401017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:04:58.986Z","updated_at":"2025-04-22T14:31:30.470Z","avatar_url":"https://github.com/Konfekt.png","language":"Vim Script","funding_links":[],"categories":["Folding","Vim Script"],"sub_categories":[],"readme":"# What good will FastFold do?\n\nAutomatic folds (that is, folds generated by a fold method different\nfrom `manual`), bog down VIM noticeably in insert mode. They are also often\nrecomputed too early (for example, when inserting an opening fold marker\nwhose closing counterpart is yet missing to complete the fold.)\n\nSee http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text\nfor a discussion.\n\nWith this plug-in, the folds in the currently edited buffer are updated by an\nautomatic fold method only\n\n- when saving the buffer\n- when closing or opening folds (zo, za, zc, etc...)\n- when moving or operating fold-wise (zj,zk,[z,]z)\n- when typing `zuz` in normal mode\n\nand are kept as is otherwise (by keeping the fold method set to `manual`).\n\n# Example Setup\n\nEach of these triggers for updating folds can be modified or disabled by adding\nthe lines\n\n```vim\nnmap zuz \u003cPlug\u003e(FastFoldUpdate)\nlet g:fastfold_savehook = 1\nlet g:fastfold_fold_command_suffixes =  ['x','X','a','A','o','O','c','C']\nlet g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk']\n```\n\nto the file `~/.vimrc` (respectively `%USERPROFILE%/_vimrc` on Microsoft Windows).\n\nFor example, by adding\n\n```vim\nlet g:markdown_folding = 1\nlet g:rst_fold_enabled = 1\nlet g:tex_fold_enabled = 1\nlet g:vimsyn_folding = 'af'\nlet g:xml_syntax_folding = 1\nlet g:javaScript_fold = 1\nlet g:sh_fold_enabled= 7\nlet g:zsh_fold_enable = 1\nlet g:ruby_fold = 1\nlet g:perl_fold = 1\nlet g:perl_fold_blocks = 1\nlet g:r_syntax_folding = 1\nlet g:rust_fold = 1\nlet g:php_folding = 1\nlet g:fortran_fold=1\nlet g:clojure_fold = 1\nlet g:baan_fold=1\n```\n\nto the `.vimrc` file and installing this plug-in, the folds in a `TeX`, `Vim`, `XML`, `JavaScript`, `(Z)SH`, `R`, `PHP`, `Ruby`, `Perl`, `Fortran`, `Clojure`  or `Baan` file are updated by the `syntax` fold method when saving the buffer, opening, closing, moving or operating on folds, or typing `zuz` in normal mode and are kept as is otherwise.\n(Likewise, in a `Markdown`, `RST` or `Rust` file, by the `expression` fold method.)\nSyntax folding  for `C` and `C++` files can be enabled by adding\n\n```vim\nautocmd FileType c,cpp setlocal foldmethod=syntax\n```\n\nto your `vimrc` (see `:help ft-c-syntax`).\nFor Python, adding\n\n```vim\nautocmd FileType python setlocal foldmethod=indent\n```\n\nto your `vimrc` mostly suffices, though installing [SimplyFold](https://github.com/tmhedberg/SimpylFold) refines folds from successive indent levels to syntax objects such as functions.\n\n# Configuration\n\n- If you prefer that folds are only updated manually but not when saving the buffer,\n  then add `let g:fastfold_savehook = 0` to your `.vimrc`.\n\n- If you prefer that folds are not updated whenever you close or open folds by a\n  standard keystroke such as `zx`,`zo` or `zc`, then add `let\n  g:fastfold_fold_command_suffixes = []` to your `.vimrc`.\n\n  The exact list of these standard keystrokes is `zx,zX,za,zA,zo,zO,zc,zC` and\n  it can be customized by changing the global variable\n  `g:fastfold_mapsuffixes`. If you wanted to intercept all possible fold\n  commands (such as zr,zm,...), change this to:\n\n    ```vim\n    let g:fastfold_fold_command_suffixes =\n    ['x','X','a','A','o','O','c','C','r','R','m','M','i','n','N']\n    ```\n\n- If you prefer that this plug-in does not add a normal mode mapping that updates\n  folds (that defaults to `zuz`), then add\n  `nmap \u003cSID\u003e(DisableFastFoldUpdate) \u003cPlug\u003e(FastFoldUpdate) ` to your `.vimrc`.\n\n  You can remap `zuz` to your favorite keystroke, say `\u003cF5\u003e`, by adding\n  `nmap \u003cF5\u003e \u003cPlug\u003e(FastFoldUpdate)` to your `.vimrc`.\n\n  There is also a command `FastFoldUpdate` that updates all folds and its\n  variant `FastFoldUpdate!` that updates all folds and echos by which fold\n  method the folds were updated.\n\n- FastFold by default only prevents the expression and syntax fold methods\n  from recomputing on every buffer change. To prevent all fold methods (except\n  manual) from doing so, add `let g:fastfold_force = 1` to your `.vimrc`.\n\n- FastFold is by default enabled for files that have more than a certain\n  number of lines, by default set to 200. To change this number, for example,\n  to enable FastFold independent of the number of lines of a file, add\n  `let g:fastfold_minlines = 0` to your `.vimrc`.\n\n# Caveats\n\nFastFold overwrites your manual folds when saving the currently edited buffer,\nunless\n\n- FastFold is disabled for this filetype by `g:fastfold_skip_filetypes`, or\n- the `foldmethod=manual` since having entered the buffer.\n\nTo ensure that sessions do not override the default fold method of the buffer file type (by the value `manual`), set `sessionoptions-=folds` in your `vimrc`.\nFor a thorougher solution, install [vim-stay](https://github.com/zhimsel/vim-stay) discussed below.\n\n# Addons\n\n## Vim-Stay\n\n`FastFold` integrates with the plug-in\n[vim-stay](https://github.com/zhimsel/vim-stay) that restores the\nfolds of a file buffer by `:mkview` and `:loadview`.\n\n## Custom Fold Text\n\nReplace the standard `\u0026foldtext`\n\n- by [one](http://www.github.com/Konfekt/FoldText) that displays the percentage of the number of buffer lines that the folded text takes up and indents folds according to their nesting level, [originally by Greg Sexton](https://web.archive.org/web/20161017143651/http://www.gregsexton.org:80/2011/03/improving-the-text-displayed-in-a-fold/), or\n- by [one](https://github.com/kaile256/vim-foldpeek) that previews the most pertinent initial text of the fold (together with the fold level and number of lines).\n\n## NrrwRgn\n\n`FastFold` integrates with the plug-in\n[NrrwRgn](https://github.com/chrisbra/NrrwRgn/) that lets you edit a selection in a new temporary buffer by adding to your `vimrc` the line\n\n```vim\n  autocmd BufWinEnter * let b:nrrw_aucmd_create = \"let w:lastfdm = getwinvar(winnr('#'), 'lastfdm')\"\n```\n\n## Fold Text-Object\n\nCreate a fold text object, mapped to `iz` and `az`, by adding the lines\n\n```vim\nxnoremap \u003csilent\u003e iz :\u003cc-u\u003eFastFoldUpdate\u003ccr\u003e]z\u003cup\u003e$v[z\u003cdown\u003e^\nxnoremap \u003csilent\u003e az :\u003cc-u\u003eFastFoldUpdate\u003ccr\u003e]zV[z\n```\n\nto the file `~/.vimrc` (respectively `%USERPROFILE%/_vimrc` on Microsoft Windows).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKonfekt%2FFastFold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKonfekt%2FFastFold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKonfekt%2FFastFold/lists"}