comparison runtime/ftplugin/cucumber.vim @ 10048:43efa4f5a8ea

commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 30 23:26:57 2016 +0200 Updated runtime files. Remove version checks for Vim older than 6.0.
author Christian Brabandt <cb@256bit.org>
date Tue, 30 Aug 2016 23:30:09 +0200
parents 2eb30f341e8d
children
comparison
equal deleted inserted replaced
10047:a62862410ca1 10048:43efa4f5a8ea
1 " Vim filetype plugin 1 " Vim filetype plugin
2 " Language: Cucumber 2 " Language: Cucumber
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4 " Last Change: 2013 Jun 01 4 " Last Change: 2016 Aug 29
5 5
6 " Only do this when not done yet for this buffer 6 " Only do this when not done yet for this buffer
7 if (exists("b:did_ftplugin")) 7 if (exists("b:did_ftplugin"))
8 finish 8 finish
9 endif 9 endif
17 setlocal omnifunc=CucumberComplete 17 setlocal omnifunc=CucumberComplete
18 18
19 let b:undo_ftplugin = "setl fo< com< cms< ofu<" 19 let b:undo_ftplugin = "setl fo< com< cms< ofu<"
20 20
21 let b:cucumber_root = expand('%:p:h:s?.*[\/]\%(features\|stories\)\zs[\/].*??') 21 let b:cucumber_root = expand('%:p:h:s?.*[\/]\%(features\|stories\)\zs[\/].*??')
22 if !exists("b:cucumber_steps_glob")
23 let b:cucumber_steps_glob = b:cucumber_root.'/**/*.rb'
24 endif
22 25
23 if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps") 26 if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps")
24 nnoremap <silent><buffer> <C-]> :<C-U>exe <SID>jump('edit',v:count)<CR> 27 cnoremap <SID>foldopen <Bar>if &foldopen =~# 'tag'<Bar>exe 'norm! zv'<Bar>endif
25 nnoremap <silent><buffer> [<C-D> :<C-U>exe <SID>jump('edit',v:count)<CR> 28 nnoremap <silent> <script> <buffer> [<C-D> :<C-U>exe <SID>jump('edit',v:count)<SID>foldopen<CR>
26 nnoremap <silent><buffer> ]<C-D> :<C-U>exe <SID>jump('edit',v:count)<CR> 29 nnoremap <silent> <script> <buffer> ]<C-D> :<C-U>exe <SID>jump('edit',v:count)<SID>foldopen<CR>
27 nnoremap <silent><buffer> <C-W>] :<C-U>exe <SID>jump('split',v:count)<CR> 30 nnoremap <silent> <script> <buffer> <C-W>d :<C-U>exe <SID>jump('split',v:count)<SID>foldopen<CR>
28 nnoremap <silent><buffer> <C-W><C-]> :<C-U>exe <SID>jump('split',v:count)<CR> 31 nnoremap <silent> <script> <buffer> <C-W><C-D> :<C-U>exe <SID>jump('split',v:count)<SID>foldopen<CR>
29 nnoremap <silent><buffer> <C-W>d :<C-U>exe <SID>jump('split',v:count)<CR> 32 nnoremap <silent> <script> <buffer> [d :<C-U>exe <SID>jump('pedit',v:count)<CR>
30 nnoremap <silent><buffer> <C-W><C-D> :<C-U>exe <SID>jump('split',v:count)<CR> 33 nnoremap <silent> <script> <buffer> ]d :<C-U>exe <SID>jump('pedit',v:count)<CR>
31 nnoremap <silent><buffer> <C-W>} :<C-U>exe <SID>jump('pedit',v:count)<CR>
32 nnoremap <silent><buffer> [d :<C-U>exe <SID>jump('pedit',v:count)<CR>
33 nnoremap <silent><buffer> ]d :<C-U>exe <SID>jump('pedit',v:count)<CR>
34 let b:undo_ftplugin .= 34 let b:undo_ftplugin .=
35 \ "|sil! nunmap <buffer> <C-]>" .
36 \ "|sil! nunmap <buffer> [<C-D>" . 35 \ "|sil! nunmap <buffer> [<C-D>" .
37 \ "|sil! nunmap <buffer> ]<C-D>" . 36 \ "|sil! nunmap <buffer> ]<C-D>" .
38 \ "|sil! nunmap <buffer> <C-W>]" .
39 \ "|sil! nunmap <buffer> <C-W><C-]>" .
40 \ "|sil! nunmap <buffer> <C-W>d" . 37 \ "|sil! nunmap <buffer> <C-W>d" .
41 \ "|sil! nunmap <buffer> <C-W><C-D>" . 38 \ "|sil! nunmap <buffer> <C-W><C-D>" .
42 \ "|sil! nunmap <buffer> <C-W>}" .
43 \ "|sil! nunmap <buffer> [d" . 39 \ "|sil! nunmap <buffer> [d" .
44 \ "|sil! nunmap <buffer> ]d" 40 \ "|sil! nunmap <buffer> ]d"
45 endif 41 endif
46 42
47 function! s:jump(command,count) 43 function! s:jump(command,count)
57 endfunction 53 endfunction
58 54
59 function! s:allsteps() 55 function! s:allsteps()
60 let step_pattern = '\C^\s*\K\k*\>\s*(\=\s*\zs\S.\{-\}\ze\s*)\=\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)' 56 let step_pattern = '\C^\s*\K\k*\>\s*(\=\s*\zs\S.\{-\}\ze\s*)\=\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)'
61 let steps = [] 57 let steps = []
62 for file in split(glob(b:cucumber_root.'/**/*.rb'),"\n") 58 for file in split(glob(b:cucumber_steps_glob),"\n")
63 let lines = readfile(file) 59 let lines = readfile(file)
64 let num = 0 60 let num = 0
65 for line in lines 61 for line in lines
66 let num += 1 62 let num += 1
67 if line =~ step_pattern 63 if line =~ step_pattern