Skip to content

Instantly share code, notes, and snippets.

@eagletmt
Created August 5, 2010 14:34
Show Gist options
  • Save eagletmt/509810 to your computer and use it in GitHub Desktop.
Save eagletmt/509810 to your computer and use it in GitHub Desktop.
vnoremap <buffer> zf :call <SID>fold_haskell()<CR>
function! s:fold_haskell() range
let str = getline(a:firstline)
if empty(str) || str =~# '\s$'
call setline(a:firstline, str . '-- {{{')
else
call setline(a:firstline, str . ' -- {{{')
endif
let str = getline(a:lastline)
if str =~# '^\s*$'
call append(a:lastline-1, '-- }}}')
elseif str =~# '\s$'
call setline(a:lastline, str . '-- }}}')
else
call setline(a:lastline, str . ' -- }}}')
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment