summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2014-11-05 17:44:52 +0100
committerBram Moolenaar <bram@vim.org>2014-11-05 17:44:52 +0100
commit87fda7e059de71e2406b82e533208d70b612c1b8 (patch)
tree71cb70501e9d1ed5f8954da77b827ef55f14bb23
parentb4766cc6d2178adb748d2baa7c62a816e2040389 (diff)
downloadvim-87fda7e059de71e2406b82e533208d70b612c1b8.tar.gz
updated for version 7.4.502v7.4.502v7-4-502
Problem: Language mapping also applies to mapped characters. Solution: Add the 'langnoremap' option, when on 'langmap' does not apply to mapped characters. (Christian Brabandt)
-rw-r--r--runtime/doc/options.txt12
-rw-r--r--runtime/vimrc_example.vim9
-rw-r--r--src/macros.h15
-rw-r--r--src/option.c7
-rw-r--r--src/option.h1
-rw-r--r--src/version.c2
6 files changed, 42 insertions, 4 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index ccf92991..525a08cd 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4589,6 +4589,18 @@ A jump table for the options with a short description can be found at |Q_op|.
:source $VIMRUNTIME/menu.vim
< Warning: This deletes all menus that you defined yourself!
+ *'langnoremap'* *'lnr'*
+'langnoremap' 'lnr' boolean (default off)
+ global
+ {not in Vi}
+ {only available when compiled with the |+langmap|
+ feature}
+ When on, setting 'langmap' does not apply to characters resulting from
+ a mapping. This basically means, if you noticed that setting
+ 'langmap' disables some of your mappings, try setting this option.
+ This option defaults to off for backwards compatibility. Set it on if
+ that works for you to avoid mappings to break.
+
*'laststatus'* *'ls'*
'laststatus' 'ls' number (default 1)
global
diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim
index 27a5cfc2..215fd246 100644
--- a/runtime/vimrc_example.vim
+++ b/runtime/vimrc_example.vim
@@ -1,7 +1,7 @@
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last change: 2014 Feb 05
+" Last change: 2014 Nov 05
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
@@ -95,3 +95,10 @@ if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
+
+if has('langmap') && exists('+langnoremap')
+ " Prevent that the langmap option applies to characters that result from a
+ " mapping. If unset (default), this may break plugins (but it's backward
+ " compatible).
+ set langnoremap
+endif
diff --git a/src/macros.h b/src/macros.h
index 2706a025..01207d91 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -128,13 +128,18 @@
* Adjust chars in a language according to 'langmap' option.
* NOTE that there is no noticeable overhead if 'langmap' is not set.
* When set the overhead for characters < 256 is small.
- * Don't apply 'langmap' if the character comes from the Stuff buffer.
+ * Don't apply 'langmap' if the character comes from the Stuff buffer or from
+ * a mapping and the langnoremap option was set.
* The do-while is just to ignore a ';' after the macro.
*/
# ifdef FEAT_MBYTE
# define LANGMAP_ADJUST(c, condition) \
do { \
- if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
+ if (*p_langmap \
+ && (condition) \
+ && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && !KeyStuffed \
+ && (c) >= 0) \
{ \
if ((c) < 256) \
c = langmap_mapchar[c]; \
@@ -145,7 +150,11 @@
# else
# define LANGMAP_ADJUST(c, condition) \
do { \
- if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
+ if (*p_langmap \
+ && (condition) \
+ && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && !KeyStuffed \
+ && (c) >= 0 && (c) < 256) \
c = langmap_mapchar[c]; \
} while (0)
# endif
diff --git a/src/option.c b/src/option.c
index 5e8e95a6..6841d42d 100644
--- 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
index 23cdecdf..b0314667 100644
--- 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' */
diff --git a/src/version.c b/src/version.c
index 3c48dc43..7bc7153f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 502,
+/**/
501,
/**/
500,