Skip to content

Commit 9e6836f

Browse files
rhysdda-x
authored andcommitted
Prefer matchit.vim to % if available
1 parent a2822b4 commit 9e6836f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

autoload/rust.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,15 @@ function! s:SearchTestFunctionNameUnderCursor() abort
499499

500500
" Search the end of test function (closing brace) to ensure that the
501501
" cursor position is within function definition
502-
normal! %
502+
if maparg('<Plug>(MatchitNormalForward)') ==# ''
503+
normal! %
504+
else
505+
" Prefer matchit.vim official plugin to native % since the plugin
506+
" provides better behavior than original % (#391)
507+
" To load the plugin, run:
508+
" :packadd matchit
509+
execute 'normal' "\<Plug>(MatchitNormalForward)"
510+
endif
503511
if line('.') < cursor_line
504512
return ''
505513
endif

0 commit comments

Comments
 (0)