diff --git a/exemples/focus_spec.rb b/exemples/focus_spec.rb new file mode 100644 index 0000000..02b9f8c --- /dev/null +++ b/exemples/focus_spec.rb @@ -0,0 +1,59 @@ +describe "Something" do + # can focus describe + + before do + # cannot focus here + end + + # can focus context + + it "can focus" do + # can focus it + + expect do + # cannot focus here + end + end + + specify "some specification" do + # can focus specify + # + expect do + # cannot focus here + end + end + + context "some context" do + # can focus context + + before do + # cannot focus here + end + + # can focus context + + expect do + # cannot focus here + end + end +end + + +feature "some feature" do + # can focus feature + + before do + # cannot focus here + end + + # can focus feature + + scenario "some scenario" do + # can focus some scenario + + expect do + # cannot focus here + end + end +end + diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 746e748..372e3d1 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -14,7 +14,7 @@ function! s:Preserve(command) endfunction function! s:AddFocusTag() - call s:Preserve("normal! ? do\C, :focus do\") + call s:Preserve("normal! ?\\(describe\\|it\\|context\\|scenario\\|feature\\|specify\\)\\s\\+['\"].*['\"]\\s\\+do\$bhi, :focus\") endfunction function! s:RemoveAllFocusTags()