From b160083f31723ac6ced8f894223caf187deb849b Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 17 Feb 2021 11:51:05 +0200 Subject: [PATCH 1/2] Basic matchit support --- python.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python.vim b/python.vim index 000ddf5..baefbfb 100644 --- a/python.vim +++ b/python.vim @@ -28,6 +28,10 @@ let b:parent_sub = './' let b:child_match = '\(\w\)\.\(\w\)' let b:child_sub = '\1/\2' +" Support for built-in "matchit" plugin +let b:match_words = '\:\:\' +let b:match_skip = 'R:^\s*' + setlocal includeexpr=substitute(substitute(substitute( \v:fname, \b:grandparent_match,b:grandparent_sub,''), @@ -173,6 +177,8 @@ let b:undo_ftplugin = 'setlocal cinkeys<' \ . '|unlet! b:child_sub' \ . '|unlet! b:grandparent_match' \ . '|unlet! b:grandparent_sub' + \ . '|unlet! b:match_skip' + \ . '|unlet! b:match_words' \ . '|unlet! b:next' \ . '|unlet! b:next_end' \ . '|unlet! b:next_endtoplevel' From 51b271fa05af5dc0dc2674925f42ad22b1e024f1 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 17 Feb 2021 11:55:08 +0200 Subject: [PATCH 2/2] Only set up matchit if the plugin was loaded --- python.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python.vim b/python.vim index baefbfb..92dcf55 100644 --- a/python.vim +++ b/python.vim @@ -28,9 +28,11 @@ let b:parent_sub = './' let b:child_match = '\(\w\)\.\(\w\)' let b:child_sub = '\1/\2' -" Support for built-in "matchit" plugin -let b:match_words = '\:\:\' -let b:match_skip = 'R:^\s*' +" Matchit support +if exists('loaded_matchit') && !exists('b:match_words') + let b:match_words = '\:\:\' + let b:match_skip = 'R:^\s*' +endif setlocal includeexpr=substitute(substitute(substitute( \v:fname,