Permalink
Browse files

Skip comment lines since they are not dependable.

  • Loading branch information...
1 parent 7d1b7f4 commit 66e58fe8069b518f4136d12764bc3ec72d8f6f26 @jonasb committed Jun 23, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 plugin/detectindent.vim
View
@@ -41,6 +41,10 @@ fun! <SID>IsCommentEnd(line)
return <SID>HasCStyleComments() && a:line =~ '\*/'
endfun
+fun! <SID>IsCommentLine(line)
+ return <SID>HasCStyleComments() && a:line =~ '^\s\+//'
+endfun
+
fun! <SID>DetectIndent()
let l:has_leading_tabs = 0
let l:has_leading_spaces = 0
@@ -73,6 +77,12 @@ fun! <SID>DetectIndent()
continue
endif
+ " Skip comment lines since they are not dependable.
+ if <SID>IsCommentLine(l:line)
+ let l:idx = l:idx + 1
+ continue
+ endif
+
" Skip lines that are solely whitespace, since they're less likely to
" be properly constructed.
if l:line !~ '\S'

0 comments on commit 66e58fe

Please sign in to comment.