A Vim plugin that creates text objects from matchit pairs, to be used with:
- Ruby (
if…end,def…end) - Blade (
@section…@endsection) - Shell (
if…fi,for…done) - Vim script (
if…endif,for…endfor) - 🤷♂️ Any other filetype that defines similar matchit pairs
Depends on vim-textobj-user and matchit.
Plug 'kana/vim-textobj-user'
Plug 'adriaanzon/vim-textobj-matchit'
runtime macros/matchit.vimIt's likely that matchit is already enabled. You can check so by running
:echo g:loaded_matchit. It will return 1 when it's enabled.
Textobj-matchit maps 2 keystrokes: am and im. They work like any other text
object: am selects the all of the matchit pair, im the inner portion of
the matchit pair.
See :h textobj-matchit for more details, including
instructions on how to define your own key mappings.
This plugin derives from vim-textobj-rubyblock and vim-textobj-blade-directive. I wanted something similar that works for every filetype, so that is why I created this plugin.
Copyright © Adriaan Zonnenberg. Distributed under the same terms as Vim itself.
See :help license.