Where can custom mappings go?
telemachus opened this issue · 1 comments
telemachus commented
I'm writing a plugin based on textobj-user, and I am trying to test whether the user can (1) unset some default mappings and (2) set their own mappings of choice.
I can test (1) by adding this in my minivimrc: let g:textobj_curly_no_default_mappings = 1
, but I cannot figure out how to test (2).
The settings in question would look like this:
omap iq <Plug>(textobj-curly-double-i)
xmap iq <Plug>(textobj-curly-double-i)
omap aq <Plug>(textobj-curly-double-a)
xmap aq <Plug>(textobj-curly-double-a)
omap iQ <Plug>(textobj-curly-single-i)
omap iQ <Plug>(textobj-curly-single-i)
omap aQ <Plug>(textobj-curly-single-a)
omap aQ <Plug>(textobj-curly-single-a)
I've tried putting those in the vimrc
and in a Before
block in the test, but nothing seems to work. Should this be supported?
Sorry if I am missing something obvious: I didn't see anything about this in the documentation. Thanks.
telemachus commented
Apologies: I figured it out after sleeping on it. The mapping commands need to go in an Execute
block. The following works:
Execute (set new xmapping):
xmap iq <Plug>(textobj-curly-double-i)
Given (a sentence with curly quotes and a curly apostrophe):
“This is fun, isn’t it?”
Do (select all text within double quotes and uppercase it):
viqU
Expect (the new mappings to work):
“THIS IS FUN, ISN’T IT?”