From 252cea169185f5a57acb6913f622950bb27458f8 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sun, 11 Jun 2023 23:21:38 +0200 Subject: Drop support for vim, cleanup nvim config --- vim/ftplugin/cucumber.vim | 132 ---------------------------------------------- 1 file changed, 132 deletions(-) delete mode 100644 vim/ftplugin/cucumber.vim (limited to 'vim/ftplugin/cucumber.vim') diff --git a/vim/ftplugin/cucumber.vim b/vim/ftplugin/cucumber.vim deleted file mode 100644 index ac1d6c9..0000000 --- a/vim/ftplugin/cucumber.vim +++ /dev/null @@ -1,132 +0,0 @@ -" Vim filetype plugin -" Language: Cucumber -" Maintainer: Tim Pope -" Last Change: 2010 Aug 09 - -" Only do this when not done yet for this buffer -if (exists("b:did_ftplugin")) - finish -endif -let b:did_ftplugin = 1 - -setlocal formatoptions-=t formatoptions+=croql -setlocal comments=:# commentstring=#\ %s -setlocal omnifunc=CucumberComplete - -let b:undo_ftplugin = "setl fo< com< cms< ofu<" - -let b:cucumber_root = expand('%:p:h:s?.*[\/]\%(features\|stories\)\zs[\/].*??') - -if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps") - nmap :exe jump('edit',v:count) - nmap ] :exe jump('split',v:count) - nmap :exe jump('split',v:count) - nmap } :exe jump('pedit',v:count) - let b:undo_ftplugin .= "| sil! nunmap | sil! nunmap ]| sil! nunmap | sil! nunmap }" -endif - -function! s:jump(command,count) - let steps = s:steps('.') - if len(steps) == 0 || len(steps) < a:count - return 'echoerr "No matching step found"' - elseif len(steps) > 1 && !a:count - return 'echoerr "Multiple matching steps found"' - else - let c = a:count ? a:count-1 : 0 - return a:command.' +'.steps[c][1].' '.escape(steps[c][0],' %#') - endif -endfunction - -function! s:allsteps() - let step_pattern = '\C^\s*\K\k*\>\s*\zs\S.\{-\}\ze\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)' - let steps = [] - for file in split(glob(b:cucumber_root.'/**/*.rb'),"\n") - let lines = readfile(file) - let num = 0 - for line in lines - let num += 1 - if line =~ step_pattern - let type = matchstr(line,'\w\+') - let steps += [[file,num,type,matchstr(line,step_pattern)]] - endif - endfor - endfor - return steps -endfunction - -function! s:steps(lnum) - let c = indent(a:lnum) + 1 - while synIDattr(synID(a:lnum,c,1),'name') !~# '^$\|Region$' - let c = c + 1 - endwhile - let step = matchstr(getline(a:lnum)[c-1 : -1],'^\s*\zs.\{-\}\ze\s*$') - return filter(s:allsteps(),'s:stepmatch(v:val[3],step)') -endfunction - -function! s:stepmatch(receiver,target) - if a:receiver =~ '^[''"].*[''"]$' - let pattern = '^'.escape(substitute(a:receiver[1:-2],'$\w\+','(.*)','g'),'/').'$' - elseif a:receiver =~ '^/.*/$' - let pattern = a:receiver[1:-2] - elseif a:receiver =~ '^%r..*.$' - let pattern = escape(a:receiver[3:-2],'/') - else - return 0 - endif - try - let vimpattern = substitute(substitute(pattern,'\\\@