not logged in (
login
)
Home
Advanced search
About Vim
Community
News
Sponsoring
Trivia
Documentation
Download
Scripts
Tips
My Account
Site Help
ZFVimFoldBlock : fold code block using regexp
script karma
Rating
18/6
, Downloaded by 730
Comments, bugs, improvements
Vim wiki
created by
zero fighter
script type
utility
description
fold code block using regexp, multiline supported, best fold plugin for general usage
git repo:
https://github.com/ZSaberLv0/ZFVimFoldBlock
preview:
* see all virtual functions `:ZFFoldBlock //virtual/`
https://raw.githubusercontent.com/ZSaberLv0/ZFVimFoldBlock/master/example0.png
* filter out all comments `:ZFFoldBlock /^[ \t]*#//`
https://raw.githubusercontent.com/ZSaberLv0/ZFVimFoldBlock/master/example1.png
* fold by xml tags `:ZFFoldBlock /(?<=<[a-z =\"_0-9]+> *\n).*/<\/[a-z0-9_]+>/` (with `othree/eregex.vim`)
https://raw.githubusercontent.com/ZSaberLv0/ZFVimFoldBlock/master/example2.png
install details
1. use Vundle(
https://github.com/VundleVim/Vundle.vim
) or any other plugin manager is recommended
Plugin 'ZSaberLv0/ZFVimFoldBlock'
when `othree/eregex.vim` installed (recommended), perl style regexp would be used instead of vim style
Plugin 'othree/eregex.vim'
or, unzip and copy content to your vim's rtp ($HOME/.vim)
2. `foldmethod` must be set to `manual`
set foldmethod = manual
by default, `foldmethod` would be set to `manual` when `ZFFoldBlock` called,
you may disable it by `let g:ZFVimFoldBlock_resetFoldmethodWhenUse=0`
3. `foldminlines` recommended set to `0`, which allow fold even for single line
set foldminlines=0
4. recommended to have these key map:
nnoremap ZB q::call ZF_FoldBlockTemplate()<cr>
nnoremap ZF :ZFFoldBlock //<left>
5. or, use the functions directly:
" fold by begin and end regexp
:ZFFoldBlock /begin_regexp/end_regexp/
" same as :ZFFoldBlock /regexp//
:ZFFoldIfMatch regexp
" same as :ZFFoldBlock //regexp/
:ZFFoldIfNotMatch regexp
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
ZFVimFoldBlock.zip
1.0
2017-06-20
7.3
zero fighter
Initial upload
ip used for rating: 3.239.76.211
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