From 6779f5ee5a6234458430cc07bb01bb47707e18e0 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 20 Feb 2014 23:34:02 -0500 Subject: [PATCH] Skip Python style triple quoted strings Closes #6. --- plugin/sleuth.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugin/sleuth.vim b/plugin/sleuth.vim index 7103267..587745d 100644 --- a/plugin/sleuth.vim +++ b/plugin/sleuth.vim @@ -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