Skip to content

Commit

Permalink
Use vim ruby block helpers plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dewyze committed Feb 16, 2018
1 parent 46541f3 commit 312aebe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
22 changes: 1 addition & 21 deletions vim/ruby_mappings.vim
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
let s:context_start_pattern =
\ '\C^\s*#\@!\s*\%(RSpec\.\)\=\zs' .
\ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin\|def' .
\ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' .
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
let s:context_end_pattern = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
let s:context_test_pattern =
\ '\C^\s*#\@!\s*\%(RSpec\.\)\=\zs' .
\ '\<\%(describe\|context\|shared_examples\|shared_context\)\>'

function! TestContext()
wall
normal 0
let [_, lnum, cnum, _] = getpos('.')
if getline('.') !~ s:context_test_pattern
let prev_line = line('.')
while line('.') != 1
call searchpair(s:context_start_pattern, '', s:context_end_pattern, 'Wb')
if getline('.') =~ s:context_test_pattern || line('.') == prev_line
break
endif
let prev_line = line('.')
endwhile
endif
RubyBlockSpecParentContext
TestNearest
call cursor(lnum, cnum)
endfunction
Expand Down
1 change: 1 addition & 0 deletions vimrc.bundles
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Plug 'benmills/vimux'
Plug 'bkad/CamelCaseMotion'
Plug 'chase/vim-ansible-yaml'
Plug 'davidzchen/vim-bazel'
Plug 'dewyze/vim-ruby-block-helpers'
Plug 'ddrscott/vim-side-search'
Plug 'derekwyatt/vim-scala'
Plug 'ekalinin/Dockerfile.vim'
Expand Down

0 comments on commit 312aebe

Please sign in to comment.