Le vendredi 9 décembre 2016 10:18:28 UTC+1, Lifepillar a écrit : > On 09/12/2016 10:07, h_east wrote: > > Hi Lifepillar, > > > > 2016-12-9(Fri) 4:35:01 UTC+9 Lifepillar: > >> Hello, > >> is it possible to remap <C-L>/<C-K>/... so that my mapping is invoked > >> when <C-L>/<C-K>/... is pressed during line/dictionary completion? > >> > >> To see what I mean, define > >> > >> imap <expr> <c-l> pumvisible()?'PUM':'BAM' > >> > >> Then, using this text: > >> > >> now and here > >> nowhere > >> no > >> > >> and with the cursor after the last character in the last line, type > >> <c-x><c-l>, then <c-l> again. Instead of inserting PUM, Vim highlights > >> the last menu entry, clearly ignoring the fact that <c-l> is mapped. Is > >> that by design? > > > > See the document. > > > > :help ins-completion > > /^Note > > > > doc> Note: The keys that are valid in CTRL-X mode are not mapped. This > > allows for > > doc> ":map ^F ^X^F" to work (where ^F is CTRL-F and ^X is CTRL-X). The key > > that > > doc> ends CTRL-X mode (any key that is not a valid CTRL-X mode command) is > > mapped. > > doc> Also, when doing completion with 'complete' mappings apply as usual. > > If, after <c-x><c-l>, Vim is still in CTRL-X sub-mode, why are other > keys remapped? For instance: > > imap <expr> <c-l> pumvisible()?'PUM':'BAM' > imap <expr> <c-k> pumvisible()?'PUM':'BAM' > > The results are as follows: > > <c-x><c-l><c-l> => <c-l> is not remapped > <c-x><c-k><c-l> => <c-l> is remapped > <c-x><c-l><c-k> => <c-k> is remapped > <c-x><c-k><c-k> => <c-k> is not remapped > > Life.
After c-x c-KEY is hit, say KEY being l, c-KEY is identical to c-n, therefore stays in ctrl-x mode. -- -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
