Skip to content

Instantly share code, notes, and snippets.

@mattsacks
Created October 6, 2011 22:40
Show Gist options
  • Save mattsacks/1268918 to your computer and use it in GitHub Desktop.
Save mattsacks/1268918 to your computer and use it in GitHub Desktop.
Easy way to make a fold with {{{,}}} markers in vim
" create a new fold with {{{ }}} markers
function! s:Fold(fold)
let beg = substitute(&commentstring, '%s', a:fold, '')
let end = substitute(&commentstring, '%s', 'END '.a:fold, '')
call setline('.', beg.' {{{')
call append('.', end.' }}}')
endfunction
command! -nargs=1 Fold :call s:Fold(<f-args>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment