summaryrefslogtreecommitdiffstats
path: root/runtime/ftplugin/cucumber.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ftplugin/cucumber.vim')
-rw-r--r--runtime/ftplugin/cucumber.vim28
1 files changed, 12 insertions, 16 deletions
diff --git a/runtime/ftplugin/cucumber.vim b/runtime/ftplugin/cucumber.vim
index 2ec1a5976f..f4848d1c60 100644
--- a/runtime/ftplugin/cucumber.vim
+++ b/runtime/ftplugin/cucumber.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2013 Jun 01
+" Last Change: 2016 Aug 29
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -19,27 +19,23 @@ 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("b:cucumber_steps_glob")
+ let b:cucumber_steps_glob = b:cucumber_root.'/**/*.rb'
+endif
if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps")
- nnoremap <silent><buffer> <C-]> :<C-U>exe <SID>jump('edit',v:count)<CR>
- nnoremap <silent><buffer> [<C-D> :<C-U>exe <SID>jump('edit',v:count)<CR>
- nnoremap <silent><buffer> ]<C-D> :<C-U>exe <SID>jump('edit',v:count)<CR>
- nnoremap <silent><buffer> <C-W>] :<C-U>exe <SID>jump('split',v:count)<CR>
- nnoremap <silent><buffer> <C-W><C-]> :<C-U>exe <SID>jump('split',v:count)<CR>
- nnoremap <silent><buffer> <C-W>d :<C-U>exe <SID>jump('split',v:count)<CR>
- nnoremap <silent><buffer> <C-W><C-D> :<C-U>exe <SID>jump('split',v:count)<CR>
- nnoremap <silent><buffer> <C-W>} :<C-U>exe <SID>jump('pedit',v:count)<CR>
- nnoremap <silent><buffer> [d :<C-U>exe <SID>jump('pedit',v:count)<CR>
- nnoremap <silent><buffer> ]d :<C-U>exe <SID>jump('pedit',v:count)<CR>
+ cnoremap <SID>foldopen <Bar>if &foldopen =~# 'tag'<Bar>exe 'norm! zv'<Bar>endif
+ nnoremap <silent> <script> <buffer> [<C-D> :<C-U>exe <SID>jump('edit',v:count)<SID>foldopen<CR>
+ nnoremap <silent> <script> <buffer> ]<C-D> :<C-U>exe <SID>jump('edit',v:count)<SID>foldopen<CR>
+ nnoremap <silent> <script> <buffer> <C-W>d :<C-U>exe <SID>jump('split',v:count)<SID>foldopen<CR>
+ nnoremap <silent> <script> <buffer> <C-W><C-D> :<C-U>exe <SID>jump('split',v:count)<SID>foldopen<CR>
+ nnoremap <silent> <script> <buffer> [d :<C-U>exe <SID>jump('pedit',v:count)<CR>
+ nnoremap <silent> <script> <buffer> ]d :<C-U>exe <SID>jump('pedit',v:count)<CR>
let b:undo_ftplugin .=
- \ "|sil! nunmap <buffer> <C-]>" .
\ "|sil! nunmap <buffer> [<C-D>" .
\ "|sil! nunmap <buffer> ]<C-D>" .
- \ "|sil! nunmap <buffer> <C-W>]" .
- \ "|sil! nunmap <buffer> <C-W><C-]>" .
\ "|sil! nunmap <buffer> <C-W>d" .
\ "|sil! nunmap <buffer> <C-W><C-D>" .
- \ "|sil! nunmap <buffer> <C-W>}" .
\ "|sil! nunmap <buffer> [d" .
\ "|sil! nunmap <buffer> ]d"
endif
@@ -59,7 +55,7 @@ endfunction
function! s:allsteps()
let step_pattern = '\C^\s*\K\k*\>\s*(\=\s*\zs\S.\{-\}\ze\s*)\=\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)'
let steps = []
- for file in split(glob(b:cucumber_root.'/**/*.rb'),"\n")
+ for file in split(glob(b:cucumber_steps_glob),"\n")
let lines = readfile(file)
let num = 0
for line in lines