Skip Python style triple quoted strings

Closes #6.
This commit is contained in:
Tim Pope 2014-02-20 23:34:02 -05:00
parent f407a8ce18
commit 6779f5ee5a
1 changed files with 20 additions and 0 deletions

View File

@ -13,6 +13,7 @@ function! s:guess(lines) abort
let heuristics = {'spaces': 0, 'hard': 0, 'soft': 0}
let ccomment = 0
let podcomment = 0
let triplequote = 0
for line in a:lines
@ -40,6 +41,25 @@ function! s:guess(lines) abort
continue
endif
if line =~# '^=\w'
let podcomment = 1
endif
if podcomment
if line =~# '^=\%(end\|cut\)\>'
let podcomment = 0
endif
continue
endif
if triplequote
if line =~# '^[^"]*"""[^"]*$'
let triplequote = 0
endif
continue
elseif line =~# '^[^"]*"""[^"]*$'
let triplequote = 1
endif
let softtab = repeat(' ', 8)
if line =~# '^\t'
let heuristics.hard += 1