aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-04-01 17:33:32 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-04-01 17:42:15 +0200
commit33ff29fc740fd437f1600d8ccc60b7b484d78d19 (patch)
tree78c56a57359c8ffde5e613ed8a641e6134bd3058
parent8de53157b691dd4ce604a5be0e2d9c3b6014bfdb (diff)
parent45a13c4bbc4a7c4f62a299c832ecc192d8f3cd0a (diff)
downloadrneovim-33ff29fc740fd437f1600d8ccc60b7b484d78d19.tar.gz
rneovim-33ff29fc740fd437f1600d8ccc60b7b484d78d19.tar.bz2
rneovim-33ff29fc740fd437f1600d8ccc60b7b484d78d19.zip
Merge #6344 'vim-patch:7.4.2236,7.4.2306'
-rw-r--r--runtime/doc/deprecated.txt1
-rw-r--r--runtime/doc/options.txt8
-rw-r--r--runtime/doc/vim_diff.txt3
-rw-r--r--src/nvim/macros.h2
-rw-r--r--src/nvim/option.c6
-rw-r--r--src/nvim/option_defs.h5
-rw-r--r--src/nvim/options.lua6
-rw-r--r--src/nvim/testdir/test_mapping.vim82
-rw-r--r--src/nvim/version.c4
9 files changed, 92 insertions, 25 deletions
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 822019340a..e77d20172e 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -44,6 +44,7 @@ Functions ~
Options ~
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
+*'langnoremap'* Deprecated alias to 'nolangremap'.
*'vi'*
*'viminfo'* Deprecated alias to 'shada' option.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index c31ebf4ebc..7d41162cfc 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3762,12 +3762,12 @@ 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 on)
+ *'langremap'* *'lrm'* *'nolangremap'* *'nolrm'*
+'langremap' 'lrm' boolean (default off)
global
- When on, setting 'langmap' does not apply to characters resulting from
+ When off, setting 'langmap' does not apply to characters resulting from
a mapping. If setting 'langmap' disables some of your mappings, make
- sure this option is set.
+ sure this option is off.
*'laststatus'* *'ls'*
'laststatus' 'ls' number (default 2)
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 11dde27868..41c0c41c80 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -45,7 +45,8 @@ these differences.
- 'history' defaults to 10000 (the maximum)
- 'hlsearch' is set by default
- 'incsearch' is set by default
-- 'langnoremap' is set by default
+- 'langnoremap' is enabled by default
+- 'langremap' is disabled by default
- 'laststatus' defaults to 2 (statusline is always shown)
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
- 'nocompatible' is always set
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index 5042663041..a8df6322cf 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -94,7 +94,7 @@
do { \
if (*p_langmap \
&& (condition) \
- && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && (p_lrm || (!p_lrm && KeyTyped)) \
&& !KeyStuffed \
&& (c) >= 0) \
{ \
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 0b4d9aae5d..b3b4dc1e0a 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3630,6 +3630,12 @@ static char *set_bool_option(const int opt_idx, char_u *const varp,
} else if ((int *)varp == &p_force_off && p_force_off == true) {
p_force_off = false;
return (char *)e_unsupportedoption;
+ } else if ((int *)varp == &p_lrm) {
+ // 'langremap' -> !'langnoremap'
+ p_lnr = !p_lrm;
+ } else if ((int *)varp == &p_lnr) {
+ // 'langnoremap' -> !'langremap'
+ p_lrm = !p_lnr;
// 'undofile'
} else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) {
// Only take action when the option was set. When reset we do not
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 2475a0b6a1..4ee0f4f225 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -476,8 +476,9 @@ EXTERN char_u *p_isp; // 'isprint'
EXTERN int p_js; // 'joinspaces'
EXTERN char_u *p_kp; // 'keywordprg'
EXTERN char_u *p_km; // 'keymodel'
-EXTERN char_u *p_langmap; // 'langmap'*/
-EXTERN int p_lnr; // 'langnoremap'*/
+EXTERN char_u *p_langmap; // 'langmap'
+EXTERN int p_lnr; // 'langnoremap'
+EXTERN int p_lrm; // 'langremap'
EXTERN char_u *p_lm; // 'langmenu'
EXTERN char_u *p_lispwords; // 'lispwords'
EXTERN long p_ls; // 'laststatus'
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index ee2b8a563d..9dff3410d6 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -1347,6 +1347,12 @@ return {
defaults={if_true={vi=false, vim=true}}
},
{
+ full_name='langremap', abbreviation='lrm',
+ type='bool', scope={'global'},
+ varname='p_lrm',
+ defaults={if_true={vi=true, vim=false}}
+ },
+ {
full_name='laststatus', abbreviation='ls',
type='number', scope={'global'},
vim=true,
diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim
index d937565ce5..6b313ff54f 100644
--- a/src/nvim/testdir/test_mapping.vim
+++ b/src/nvim/testdir/test_mapping.vim
@@ -35,29 +35,81 @@ func Test_map_ctrl_c_visual()
endfunc
func Test_map_langmap()
- " langmap should not get remapped in insert mode
- inoremap { FAIL_ilangmap
- set langmap=+{ langnoremap
+ if !has('langmap')
+ return
+ endif
+
+ " check langmap applies in normal mode
+ set langmap=+- nolangremap
+ new
+ call setline(1, ['a', 'b', 'c'])
+ 2
+ call assert_equal('b', getline('.'))
+ call feedkeys("+", "xt")
+ call assert_equal('a', getline('.'))
+
+ " check no remapping
+ map x +
+ 2
+ call feedkeys("x", "xt")
+ call assert_equal('c', getline('.'))
+
+ " check with remapping
+ set langremap
+ 2
+ call feedkeys("x", "xt")
+ call assert_equal('a', getline('.'))
+
+ unmap x
+ bwipe!
+
+ " 'langnoremap' follows 'langremap' and vise versa
+ set langremap
+ set langnoremap
+ call assert_equal(0, &langremap)
+ set langremap
+ call assert_equal(0, &langnoremap)
+ set nolangremap
+ call assert_equal(1, &langnoremap)
+
+ " check default values
+ set langnoremap&
+ call assert_equal(1, &langnoremap)
+ call assert_equal(0, &langremap)
+ set langremap&
+ call assert_equal(1, &langnoremap)
+ call assert_equal(0, &langremap)
+
+ " langmap should not apply in insert mode, 'langremap' doesn't matter
+ set langmap=+{ nolangremap
call feedkeys("Go+\<Esc>", "xt")
call assert_equal('+', getline('$'))
-
- " Insert-mode expr mapping with langmap
- inoremap <expr> { "FAIL_iexplangmap"
+ set langmap=+{ langremap
call feedkeys("Go+\<Esc>", "xt")
call assert_equal('+', getline('$'))
- iunmap <expr> {
- " langmap should not get remapped in Command-line mode
- cnoremap { FAIL_clangmap
+ " langmap used for register name in insert mode.
+ call setreg('a', 'aaaa')
+ call setreg('b', 'bbbb')
+ call setreg('c', 'cccc')
+ set langmap=ab langremap
+ call feedkeys("Go\<C-R>a\<Esc>", "xt")
+ call assert_equal('bbbb', getline('$'))
+ call feedkeys("Go\<C-R>\<C-R>a\<Esc>", "xt")
+ call assert_equal('bbbb', getline('$'))
+ " mapping does not apply
+ imap c a
+ call feedkeys("Go\<C-R>c\<Esc>", "xt")
+ call assert_equal('cccc', getline('$'))
+ imap a c
+ call feedkeys("Go\<C-R>a\<Esc>", "xt")
+ call assert_equal('bbbb', getline('$'))
+
+ " langmap should not apply in Command-line mode
+ set langmap=+{ nolangremap
call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
call assert_equal('+', getline('$'))
- cunmap {
- " Command-line mode expr mapping with langmap
- cnoremap <expr> { "FAIL_cexplangmap"
- call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
- call assert_equal('+', getline('$'))
- cunmap {
set nomodified
endfunc
diff --git a/src/nvim/version.c b/src/nvim/version.c
index fdf5436a98..0ee0419849 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -135,7 +135,7 @@ static const int included_patches[] = {
2309,
// 2308 NA
2307,
- // 2306,
+ 2306,
2305,
// 2304 NA
2303,
@@ -205,7 +205,7 @@ static const int included_patches[] = {
// 2239,
// 2238 NA
2237,
- // 2236,
+ 2236,
2235,
// 2234 NA
2233,