Skip to content

Instantly share code, notes, and snippets.

@suy
Created January 9, 2015 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suy/642578f174d03499fa3d to your computer and use it in GitHub Desktop.
Save suy/642578f174d03499fa3d to your computer and use it in GitHub Desktop.
augroup FoldComments
autocmd!
autocmd BufReadPost * :call s:Fold()
augroup END
function! s:Fold() abort
let starting_position = getcurpos()
keepjumps normal! gg
" TODO: be smart and only fold if the comment has copyright info.
if hlID("Comment") == synIDtrans(synID(1,1,0))
silent! normal! zc
endif
call setpos('.', starting_position)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment