Wednesday, March 21, 2018

Re: Questions about mapping information

2018-03-21 10:34 GMT+03:00 Lifepillar <lifepillar@lifepillar.me>:
> I am trying to debug an issue with my plugin (µcomplete) and auto-pairs,
> and I have a couple of questions about the way Vim displays information
> about mappings.
>
> I have these definitions in my vimrc:
>
> imap <plug>MyCR <plug>(MUcompleteCR)
> imap <cr> <plug>MyCR
>
> Auto-pairs maps <cr>, too, and it tries hard not to override an existing
> mapping. After loading, :verbose imap <cr> shows this:
>
> i <CR> &@<Plug>(MUcompleteCR)<SNR>24_AutoPairsReturn
> Last set from ~/.vim/pack/bundle/start/auto-pairs/plugin/auto-pairs.vim
>
> i <CR> <Plug>MyCR
> Last set from ~/.vim/vimrc
>
> I think auto-pairs expands the current mapping and appends its own
> definition.
>
> First question: why are there two definitions instead of one? I.e., why
> is the mapping from my vimrc shown at all?

Due to buffer-local mappings there may exist at most {number of loaded
buffers present}+1 mapping definitions, with buffer-local mappings
attached to the current buffer taking precedence over global mapping
definition and buffer-local mappings attached to other buffers
ignored.

>
> Second question: what does &@ mean in the first definition?

There is `:h map-listing` which explains both. You could found that by
searching for `&` after `:h :map`; though there are some mishits.

>
> For the record, the issue is that, with those definitions in place,
> when I type <cr>, Vim inserts <plug>(MUcompleteCR) literally in the
> buffer, although that plug exists.
>
> Thanks,
> Life.
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> --- You received this message because you are subscribed to the Google
> Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: