Bram,
what is the reason, setting 'lmap' applies to when a mapping is
remapped?
Consider this:
~$ cat lmap.vim
imap <tab> <Plug>MyPluginEcho
imap <Plug>MyPluginEcho <c-r>="hello"<cr>
cmap <tab> <Plug>MyPluginEcho
cmap <Plug>MyPluginEcho <c-r>="hello"<cr>
" set lmap=i;k
run vim -u lmap.vim -N
and type <tab> in insert mode, note, how "hello" is printed in either
insert mode or command line mode.
Now do
:set lmap=i;k
and do it again. Note that <Plug>MyPluginEcho will be output.
The problem is, setting lmap breaks plugins (see e.g. here:
http://stackoverflow.com/questions/12450803)
I would consider this is a bug and actually think, that setting 'lmap' should
never be applied to when recursively resolving a mapping.
Also, I do not understand what this part of the help is trying to say:
,----[ :h 'lmap' ]-
| This will allow you to activate vim actions without having to switch
| back and forth between the languages. Your language characters will
| be understood as normal vim English characters (according to the
| langmap mappings) in the following cases:
| o Normal/Visual mode (commands, buffer/register names, user mappings)
| o Insert/Replace Mode: Register names after CTRL-R
| o Insert/Replace Mode: Mappings
| Characters entered in Command-line mode will NOT be affected by
| this option. Note that this option can be changed at any time
| allowing to switch between mappings for different languages/encodings.
| Use a mapping to avoid having to type it each time!
`----
What are the language characters? What is the relationship to lmap
mappings?
This patch could fix it, but I am not sure, this fixes it correctly.
diff --git a/src/getchar.c b/src/getchar.c
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2196,12 +2196,16 @@ vgetorpeek(advance)
{
#ifdef FEAT_LANGMAP
c2 = typebuf.tb_buf[typebuf.tb_off + mlen];
- if (nomap > 0)
- --nomap;
- else if (c2 == K_SPECIAL)
- nomap = 2;
- else
- LANGMAP_ADJUST(c2, TRUE);
+ /* do not apply lmap setting when resolving a mapping */
+ if (typebuf_maplen() != typebuf.tb_len)
+ {
+ if (nomap > 0)
+ --nomap;
+ else if (c2 == K_SPECIAL)
+ nomap = 2;
+ else
+ LANGMAP_ADJUST(c2, TRUE);
+ }
if (mp->m_keys[mlen] != c2)
#else
if (mp->m_keys[mlen] !=
Mit freundlichen Grüßen
Christian
--
Letzte Worte eines Dachdeckers:
"Mensch ist das heute ein Wind"