Fork me on GitHub
#vim
<
2020-08-07
>
orestis07:08:23

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)

orestis07:08:56

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.

Olical10:08:12

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.

Olical10:08:01

I'm not actually sure if you need to <c-o> there, @orestis :thinking_face: perhaps you've already tried without it though?

Olical10:08:32

Oh! You should probably use imap, not inoremap!

Olical10:08:13

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.

Olical10:08:57

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.

orestis10:08:13

Ah! Thanks

orestis10:08:43

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.

orestis10:08:33

Hooray imap <buffer> <C-right> <C-o><Plug>(sexp_capture_next_element) works