vim-sandwich
vim-sandwich copied to clipboard
Mappings overlap in operation-pending mode
Hello, after installation I cannot use as, is motions, like in das to delete around a sentence.
In /vim-sandwich/plugin/textobj have to comment these lines, then everything works fine in operation-pending mode.
What did I do wrong? I use latest neovim repo on arch.
" silent! omap <unique> is <Plug>(textobj-sandwich-query-i)
" silent! xmap <unique> is <Plug>(textobj-sandwich-query-i)
" silent! omap <unique> as <Plug>(textobj-sandwich-query-a)
" silent! xmap <unique> as <Plug>(textobj-sandwich-query-a)
You haven't done anything wrong: the plugin author picked is and as even though those mappings were used for sentences by vim itself. See #62 for more discussion.
Instead of commenting out those lines in the plugin itself, you can define your own mappings for textobj-sandwich-query in your startup files. That way, you get the functionality, and you keep the normal is and as mappings. There is an example of that in the issue I linked.
That example maps textobj-sandwich-query to iq and aq (instead of is and as), but if you use vim-textobj-quote, that's also a problem. (Because vim-textobj-quote wants to map iq and aq!) Since I use both plugins, I map textobj-sandwich-query to ic and ac.
" stop vim-sandwich from stomping on |is| and |as|
let g:textobj_sandwich_no_default_key_mappings = 1
xmap ib <Plug>(textobj-sandwich-auto-i)
omap ib <Plug>(textobj-sandwich-auto-i)
xmap ab <Plug>(textobj-sandwich-auto-a)
omap ab <Plug>(textobj-sandwich-auto-a)
xmap ic <Plug>(textobj-sandwich-query-i)
omap ic <Plug>(textobj-sandwich-query-i)
xmap ac <Plug>(textobj-sandwich-query-a)
omap ac <Plug>(textobj-sandwich-query-a)
Thanks. @telemachus is right. First, disable the default mappings and then map keys as you want.
https://github.com/machakann/vim-sandwich/blob/master/doc/textobj-sandwich.txt#L166