provide a general motion for block text-objects with highlight!
After initial load, gmotion will automatically parse the current buffer, if it finds any block text-object (like ""、[]、''、()、<>, {}...) in current line, it will highlight the prefix and the suffix part of the text-object.
By default, only ""
, []
, ''
, ()
, <>
, {}
surrounded text-object are defined, you can define your own text-object, see[Custom](# Custom Configuration) for more details and limitations.
If you familiar with vim's text-objects, than you must be used to using these ci(
、di{
、ci"
、ya[
quick motions, however, sometimes you may find it takes a bit time to determine which key to press, not to mention ({<"
are far from fingers.
This is where gmotion help you out, instead of typing i(
、i{
、a[
、a<
, typing ig
and ag
will work the same. With highlighted prefix and surffix, you can easily tell which text-object is on operation.
By typing gh
or gl
, you can move quickily to the left or right part of the text-object
gmotion also help you change or delete text-objects's prefix and surffix.
By chaning the g:gmotion_pair
in your .vimrc
, you can add or delete text-objects,
let g:gmotion_pair = [
\ ['(', ')'],
\ ['[', ']'],
\ ['{', '}'],
\ ['<', '>'],
\ ['"', '"'],
\ ["'", "'"],
\ ['`', '`']]
You can also cutomize the highlight group gmotion use, just by assinging your hlgroup to g:gmotion_highligh_group
let g:gmotion_highligh_group = 'MatchParen'
Add following line in the plug section in your .vimrc
Plug 'Chen-Rong-Zi/gmotion.vim', { 'do': { -> popup_notification(['Gmotion Installed'], {'time': 1000})} }
source
your .vimrc and :PlugInstall
, you may notice the popup notification window that says 'Gmotion Installed'