Hi Bram!
On Mi, 15 Okt 2014, Bram Moolenaar wrote:
>
> Christian Brabandt wrote:
>
> > Bram,
> > what is the reason, setting 'lmap' applies to when a mapping is
> > remapped?
>
> I can't remember. I believe it has always been this way. Perhaps not
> intentionally.
>
> > 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.
>
> Since langmap is supposed to map typed characters, it makes sense that
> the RHS of a mapping is not langmapped.
>
> > 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?
>
> Language characters is what comes out of the keyboard when switched to a
> specific language, e.g. Greek. Then the "a" key produces the "α"
> character.
>
> It's possible that this was only tested for when the keyboard produces
> non-ascii characters.
>
> > This patch could fix it, but I am not sure, this fixes it correctly.
>
> I think you need to compare mlen to typebuf.tb_maplen.
Okay, here is a patch, that does that when the new option 'langnoremap'
is set (which defaults to off for backwards compatibility)
Best,
Christian
--
Computer sind nicht intelligent. Sie glauben das nur.
--
--
You received this message from the "vim_dev" 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_dev" 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.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4589,6 +4589,16 @@ A jump table for the options with a shor
:source $VIMRUNTIME/menu.vim
< Warning: This deletes all menus that you defined yourself!
+ *'langmap'* *'lmap'* *E357* *E358*
+'langnoremap' 'lnr' boolean (default off)
+ global
+ {not in Vi}
+ {only available when compiled with the |+langmap|
+ feature}
+ When on, setting 'lmap' does not apply when resolving mappings
+ recursively. This basically means, if you noticed that setting 'lmap'
+ will disable your mappings, try setting this option.
+
*'laststatus'* *'ls'*
'laststatus' 'ls' number (default 1)
global
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 (!(p_lnr && typebuf_maplen() >= mlen))
+ {
+ 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] !=
diff --git a/src/option.c b/src/option.c
--- a/src/option.c
+++ b/src/option.c
@@ -1691,6 +1691,13 @@ static struct vimoption
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
+ {"langnoremap", "lnr", P_BOOL|P_VI_DEF,
+#ifdef FEAT_LANGMAP
+ (char_u *)&p_lnr, PV_NONE,
+#else
+ (char_u *)NULL, PV_NONE,
+#endif
+ {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL,
#ifdef FEAT_WINDOWS
(char_u *)&p_ls, PV_NONE,
diff --git a/src/option.h b/src/option.h
--- a/src/option.h
+++ b/src/option.h
@@ -576,6 +576,7 @@ EXTERN char_u *p_kp; /* 'keywordprg' */
EXTERN char_u *p_km; /* 'keymodel' */
#ifdef FEAT_LANGMAP
EXTERN char_u *p_langmap; /* 'langmap'*/
+EXTERN int p_lnr; /* 'langnoremap' */
#endif
#if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
EXTERN char_u *p_lm; /* 'langmenu' */