diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-06-01 14:50:56 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-06-01 14:50:56 +0200 |
commit | 543b7ef7000d08d77409478315d68b607bb8bad8 (patch) | |
tree | 387cd45294ce55a130556d4e22a0b7706156b1fd /runtime/ftplugin/cucumber.vim | |
parent | 3737fc1c30a559c82c57b5ce6aedae76cbeabaef (diff) |
Updated runtime files and translations.
Diffstat (limited to 'runtime/ftplugin/cucumber.vim')
-rw-r--r-- | runtime/ftplugin/cucumber.vim | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/runtime/ftplugin/cucumber.vim b/runtime/ftplugin/cucumber.vim index a29d46a039..2ec1a5976f 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: 2010 Aug 09 +" Last Change: 2013 Jun 01 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -9,6 +9,9 @@ if (exists("b:did_ftplugin")) endif let b:did_ftplugin = 1 +let s:keepcpo= &cpo +set cpo&vim + setlocal formatoptions-=t formatoptions+=croql setlocal comments=:# commentstring=#\ %s setlocal omnifunc=CucumberComplete @@ -18,11 +21,27 @@ 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 <silent><buffer> <C-]> :<C-U>exe <SID>jump('edit',v:count)<CR> - nmap <silent><buffer> <C-W>] :<C-U>exe <SID>jump('split',v:count)<CR> - nmap <silent><buffer> <C-W><C-]> :<C-U>exe <SID>jump('split',v:count)<CR> - nmap <silent><buffer> <C-W>} :<C-U>exe <SID>jump('pedit',v:count)<CR> - let b:undo_ftplugin .= "| sil! iunmap! <C-]>| sil! iunmap! <C-W>]| sil! iunmap! <C-W><C-]>| sil! iunmap! <C-W>}" + 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> + 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 function! s:jump(command,count) @@ -38,7 +57,7 @@ function! s:jump(command,count) endfunction function! s:allsteps() - let step_pattern = '\C^\s*\K\k*\>\s*\zs\S.\{-\}\ze\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)' + 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") let lines = readfile(file) @@ -55,7 +74,7 @@ function! s:allsteps() endfunction function! s:steps(lnum) - 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 @@ -129,4 +148,7 @@ function! CucumberComplete(findstart,base) abort return sort(steps) endfunction +let &cpo = s:keepcpo +unlet s:keepcpo + " vim:set sts=2 sw=2: |