A Vim plugin that creates text objects from matchit pairs, to be used with:
if…end
, def…end
)@section…@endsection
)if…fi
, for…done
)if…endif
, for…endfor
)Depends on vim-textobj-user and matchit.
Plug 'kana/vim-textobj-user'
Plug 'adriaanzon/vim-textobj-matchit'
runtime macros/matchit.vim
It'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
.