Last active
December 15, 2015 18:09
-
-
Save kshenoy/5302176 to your computer and use it in GitHub Desktop.
Function to open folds that have less than the specified number of lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! FoldAllBut( foldminlines ) | |
" Description: Function to open folds that have less than the specified number of lines | |
" We assume that the folds are initially closed | |
" If a fold exists and is closed and has lesser number of lines than specified, open it and all nested folds | |
" Note: This does not work on nested folds | |
folddoclosed | |
\ if (( foldclosed(".") >= 0 ) && ( foldclosedend(".") - foldclosed(".") + 1 < a:foldminlines )) | |
\ exe 'normal! zO' | |
\ endif | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, works properly now. Updated it at my end as well.