Folding in Vim
Folding in Vim is really powerful. If you want to dig into the dark side of Vim, then folding is an useful feature to check out. Here is how I use this feature.
Python code foldingOne can use python_fold script to fold Python code. Python code will look something like this:
JavaScript foldAdd this to your vimrc to enable folding of JavaScript code:
function! JavaScriptFold()
setl foldmethod=syntax
setl foldlevelstart=1
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
function! FoldText()
return substitute(getline(v:foldstart), '{.*', '{...}', '')
endfunction
setl foldtext=FoldText()
endfunction
au FileType javascript call JavaScriptFold()
au FileType javascript setl fen
JavaScript code will look something like this:
Code
·
Tips
·
VIM Editor
•
13. Apr 2007
|
|