From e92e0c635b2dbee1318e06f66c69c795272edf71 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 20 Feb 2014 11:34:42 -0500 Subject: [PATCH] when finding python objects don't count comments (fixes issue #18) --- ftplugin/python/pytest.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ftplugin/python/pytest.vim b/ftplugin/python/pytest.vim index 529c443..9f722b2 100755 --- a/ftplugin/python/pytest.vim +++ b/ftplugin/python/pytest.vim @@ -271,8 +271,9 @@ function! s:FindPythonObject(obj) " " Very naive, but if the indent is less than or equal to four " keep on going because we assume you are nesting. + " Do not count lines that are comments though. " - if indent(line('.')) <= 4 + if (indent(line('.')) <= 4) && !(getline(line('.')) =~ '\v^\s*#(.*)') return 1 endif endwhile @@ -332,7 +333,7 @@ function! s:ProjectPath() let path = fnamemodify(projecttestdir, ':p:h') elseif(len(projecttestfile) != 0) let path = fnamemodify(projecttestfile, ':p') - else + else let path = '' endif @@ -1005,7 +1006,7 @@ function! s:Proxy(action, ...) call s:ThisFile(verbose, pdb, delgado) endif elseif (a:action == "project" ) - if looponfail ==1 + if looponfail ==1 call s:LoopOnFail(a:action) call s:ThisProject(verbose, pdb, delgado) else