I’m tearing my hairs out trying to might <C-right>
to do a slurp in insert mode using vim-sexp. I’m trying to use guidance from vim-sexp-mappings-for-regular-people which does:
nmap <buffer> >) <Plug>(sexp_capture_next_element)
I got to:
inoremap <buffer> <C-right> <C-o><Plug>(sexp_capture_next_element)
which doesn’t do anything, which is an improvement over previous attempts, but I’m possibly missing something fundamental. I’ve no idea what <Plug>is supposed to mean.So <plug>
is a sort of meta prefix plugin authors should use for all of their mappings. There is no way to directly press <plug>
unlike <leader>
etc which can be assigned to a key. I don't think plug can be? Or at least it isn't by default.
So the idea is that the mappings exist but they're not mapped to anything you can press, it is then up to you to define your own mappings that press this magical <plug>
key combination for you.
I'm not actually sure if you need to <c-o>
there, @orestis :thinking_face: perhaps you've already tried without it though?
Oh! You should probably use imap
, not inoremap
!
The noremap
means "ignore any other mappings to avoid infinite loops, just use whatever built in mappings there were", so that means the sexp
mapping won't get called, it'll basically do nothing.
noremap
is great if you want to use gf
or whatever and you have another plugin that might be overriding it. If however you want to map to some existing mapping from a plugin, you can't use noremap
. You want to map to another mapping.
Ah! Thanks
I also figured out some issue that I had when I used vim-better-default (based on your excellent blogpost) — I had to call
runtime! plugin/default.vim
and then override any settings after that, otherwise a lot of settings were not “taking”, which was madenning.Hooray imap <buffer> <C-right> <C-o><Plug>(sexp_capture_next_element)
works
Woo! 😄
🎉