tpope / vim-cucumber

Vim Cucumber runtime files

Home Page:http://www.vim.org/scripts/script.php?script_id=2973

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jump to gerkin files with tabs

tbhi opened this issue · comments

I came across a file in our source tree were the jump to step definition wasn't working. Investigation indicated that this was due to use indent returning the wrong string start position when tabs are used. The following works for me but I'm not sure whether there is better vim api to use.

diff --git a/ftplugin/cucumber.vim b/ftplugin/cucumber.vim
index fb31fde..46e7024 100644
--- a/ftplugin/cucumber.vim
+++ b/ftplugin/cucumber.vim
@@ -71,7 +71,8 @@ function! s:allsteps()
 endfunction

 function! s:steps(lnum)
-  let c = indent(a:lnum) + 1
+  "let c = indent(a:lnum) + 1
+  let c = match(getline(a:lnum), '\S') + 1
   while synIDattr(synID(a:lnum,c,1),'name') !~# '^$\|Region$'
     let c = c + 1
   endwhile