bairui

Jump Past Leading Comments

Jun 24th, 2011
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.38 KB | None | 0 0
  1. " Jump Past Leading Comments
  2. " Barry Arthur, June 24 2011
  3.  
  4. " NOTE: I actually do this slightly differently for C files (which have a
  5. " block comment instead of line-terminated comments)
  6.  
  7. function! JPFC()
  8.   let cs = '^\s*[^' . escape(matchstr(&cms, '^\S\+'), '*\') . ']'
  9.  call search(cs, 'cW')
  10. endfunction
  11.  
  12. augroup CommentJumper
  13.  au!
  14.  au BufRead * call JPFC()
  15. augroup END
Advertisement
Add Comment
Please, Sign In to add comment