mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 05:35:10 -07:00
Merge #11467 from janlazo/vim-8.1.2345
vim-patch:8.1.{1252,1253,1254,1268,2345,2348,2349}
This commit is contained in:
commit
86c4a87fe9
@ -1,7 +1,7 @@
|
|||||||
" Vim support file to detect file types
|
" Vim support file to detect file types
|
||||||
"
|
"
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2019 Aug 26
|
" Last Change: 2019 Nov 26
|
||||||
|
|
||||||
" Listen very carefully, I will say this only once
|
" Listen very carefully, I will say this only once
|
||||||
if exists("did_load_filetypes")
|
if exists("did_load_filetypes")
|
||||||
@ -796,8 +796,8 @@ au BufNewFile,BufRead *.java,*.jav setf java
|
|||||||
" JavaCC
|
" JavaCC
|
||||||
au BufNewFile,BufRead *.jj,*.jjt setf javacc
|
au BufNewFile,BufRead *.jj,*.jjt setf javacc
|
||||||
|
|
||||||
" JavaScript, ECMAScript
|
" JavaScript, ECMAScript, ES module script, CommonJS script
|
||||||
au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs setf javascript
|
au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs,*.cjs setf javascript
|
||||||
|
|
||||||
" JavaScript with React
|
" JavaScript with React
|
||||||
au BufNewFile,BufRead *.jsx setf javascriptreact
|
au BufNewFile,BufRead *.jsx setf javascriptreact
|
||||||
|
@ -2872,7 +2872,7 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
|
|||||||
int c;
|
int c;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
if (cmdidx == CMD_let) {
|
if (cmdidx == CMD_let || cmdidx == CMD_const) {
|
||||||
xp->xp_context = EXPAND_USER_VARS;
|
xp->xp_context = EXPAND_USER_VARS;
|
||||||
if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL) {
|
if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL) {
|
||||||
/* ":let var1 var2 ...": find last space. */
|
/* ":let var1 var2 ...": find last space. */
|
||||||
|
@ -2126,6 +2126,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
case CMD_browse:
|
case CMD_browse:
|
||||||
case CMD_call:
|
case CMD_call:
|
||||||
case CMD_confirm:
|
case CMD_confirm:
|
||||||
|
case CMD_const:
|
||||||
case CMD_delfunction:
|
case CMD_delfunction:
|
||||||
case CMD_djump:
|
case CMD_djump:
|
||||||
case CMD_dlist:
|
case CMD_dlist:
|
||||||
@ -2150,6 +2151,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
case CMD_leftabove:
|
case CMD_leftabove:
|
||||||
case CMD_let:
|
case CMD_let:
|
||||||
case CMD_lockmarks:
|
case CMD_lockmarks:
|
||||||
|
case CMD_lockvar:
|
||||||
case CMD_lua:
|
case CMD_lua:
|
||||||
case CMD_match:
|
case CMD_match:
|
||||||
case CMD_mzscheme:
|
case CMD_mzscheme:
|
||||||
@ -2178,6 +2180,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
case CMD_tilde:
|
case CMD_tilde:
|
||||||
case CMD_topleft:
|
case CMD_topleft:
|
||||||
case CMD_unlet:
|
case CMD_unlet:
|
||||||
|
case CMD_unlockvar:
|
||||||
case CMD_verbose:
|
case CMD_verbose:
|
||||||
case CMD_vertical:
|
case CMD_vertical:
|
||||||
case CMD_wincmd:
|
case CMD_wincmd:
|
||||||
@ -3437,6 +3440,7 @@ const char * set_one_cmd_context(
|
|||||||
case CMD_syntax:
|
case CMD_syntax:
|
||||||
set_context_in_syntax_cmd(xp, arg);
|
set_context_in_syntax_cmd(xp, arg);
|
||||||
break;
|
break;
|
||||||
|
case CMD_const:
|
||||||
case CMD_let:
|
case CMD_let:
|
||||||
case CMD_if:
|
case CMD_if:
|
||||||
case CMD_elseif:
|
case CMD_elseif:
|
||||||
|
@ -78,26 +78,45 @@ func Test_map_completion()
|
|||||||
call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
|
call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
call assert_equal('"map <silent> <special>', getreg(':'))
|
call assert_equal('"map <silent> <special>', getreg(':'))
|
||||||
|
|
||||||
|
map <Middle>x middle
|
||||||
|
|
||||||
map ,f commaf
|
map ,f commaf
|
||||||
map ,g commaf
|
map ,g commaf
|
||||||
|
map <Left> left
|
||||||
|
map <A-Left>x shiftleft
|
||||||
call feedkeys(":map ,\<Tab>\<Home>\"\<CR>", 'xt')
|
call feedkeys(":map ,\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
call assert_equal('"map ,f', getreg(':'))
|
call assert_equal('"map ,f', getreg(':'))
|
||||||
call feedkeys(":map ,\<Tab>\<Tab>\<Home>\"\<CR>", 'xt')
|
call feedkeys(":map ,\<Tab>\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
call assert_equal('"map ,g', getreg(':'))
|
call assert_equal('"map ,g', getreg(':'))
|
||||||
|
call feedkeys(":map <L\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
|
call assert_equal('"map <Left>', getreg(':'))
|
||||||
|
call feedkeys(":map <A-Left>\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
|
call assert_equal("\"map <A-Left>\<Tab>", getreg(':'))
|
||||||
unmap ,f
|
unmap ,f
|
||||||
unmap ,g
|
unmap ,g
|
||||||
|
unmap <Left>
|
||||||
|
unmap <A-Left>x
|
||||||
|
|
||||||
set cpo-=< cpo-=B cpo-=k
|
set cpo-=< cpo-=B cpo-=k
|
||||||
map <Left> left
|
map <Left> left
|
||||||
call feedkeys(":map <L\<Tab>\<Home>\"\<CR>", 'xt')
|
call feedkeys(":map <L\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
call assert_equal('"map <Left>', getreg(':'))
|
call assert_equal('"map <Left>', getreg(':'))
|
||||||
|
call feedkeys(":map <M\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
|
" call assert_equal("\"map <M\<Tab>", getreg(':'))
|
||||||
unmap <Left>
|
unmap <Left>
|
||||||
|
|
||||||
" set cpo+=<
|
" set cpo+=<
|
||||||
map <Left> left
|
map <Left> left
|
||||||
|
exe "set t_k6=\<Esc>[17~"
|
||||||
|
call feedkeys(":map \<Esc>[17~x f6x\<CR>", 'xt')
|
||||||
call feedkeys(":map <L\<Tab>\<Home>\"\<CR>", 'xt')
|
call feedkeys(":map <L\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
call assert_equal('"map <Left>', getreg(':'))
|
call assert_equal('"map <Left>', getreg(':'))
|
||||||
|
if !has('gui_running')
|
||||||
|
call feedkeys(":map \<Esc>[17~\<Tab>\<Home>\"\<CR>", 'xt')
|
||||||
|
" call assert_equal("\"map <F6>x", getreg(':'))
|
||||||
|
endif
|
||||||
unmap <Left>
|
unmap <Left>
|
||||||
|
call feedkeys(":unmap \<Esc>[17~x\<CR>", 'xt')
|
||||||
set cpo-=<
|
set cpo-=<
|
||||||
|
|
||||||
set cpo+=B
|
set cpo+=B
|
||||||
@ -113,6 +132,9 @@ func Test_map_completion()
|
|||||||
call assert_equal('"map <Left>', getreg(':'))
|
call assert_equal('"map <Left>', getreg(':'))
|
||||||
unmap <Left>
|
unmap <Left>
|
||||||
" set cpo-=k
|
" set cpo-=k
|
||||||
|
|
||||||
|
unmap <Middle>x
|
||||||
|
set cpo&vim
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_match_completion()
|
func Test_match_completion()
|
||||||
@ -159,6 +181,7 @@ func Test_expr_completion()
|
|||||||
endif
|
endif
|
||||||
for cmd in [
|
for cmd in [
|
||||||
\ 'let a = ',
|
\ 'let a = ',
|
||||||
|
\ 'const a = ',
|
||||||
\ 'if',
|
\ 'if',
|
||||||
\ 'elseif',
|
\ 'elseif',
|
||||||
\ 'while',
|
\ 'while',
|
||||||
|
@ -176,6 +176,26 @@ func Test_cannot_modify_existing_variable()
|
|||||||
call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:')
|
call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_const_with_condition()
|
||||||
|
const x = 0
|
||||||
|
if 0 | const x = 1 | endif
|
||||||
|
call assert_equal(0, x)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_lockvar()
|
||||||
|
let x = 'hello'
|
||||||
|
lockvar x
|
||||||
|
call assert_fails('let x = "there"', 'E741')
|
||||||
|
if 0 | unlockvar x | endif
|
||||||
|
call assert_fails('let x = "there"', 'E741')
|
||||||
|
unlockvar x
|
||||||
|
let x = 'there'
|
||||||
|
|
||||||
|
if 0 | lockvar x | endif
|
||||||
|
let x = 'again'
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
func Test_const_with_index_access()
|
func Test_const_with_index_access()
|
||||||
let l = [1, 2, 3]
|
let l = [1, 2, 3]
|
||||||
call assert_fails('const l[0] = 4', 'E996:')
|
call assert_fails('const l[0] = 4', 'E996:')
|
||||||
|
@ -223,7 +223,7 @@ let s:filename_checks = {
|
|||||||
\ 'jam': ['file.jpl', 'file.jpr'],
|
\ 'jam': ['file.jpl', 'file.jpr'],
|
||||||
\ 'java': ['file.java', 'file.jav'],
|
\ 'java': ['file.java', 'file.jav'],
|
||||||
\ 'javacc': ['file.jj', 'file.jjt'],
|
\ 'javacc': ['file.jj', 'file.jjt'],
|
||||||
\ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.mjs'],
|
\ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'],
|
||||||
\ 'javascriptreact': ['file.jsx'],
|
\ 'javascriptreact': ['file.jsx'],
|
||||||
\ 'jess': ['file.clp'],
|
\ 'jess': ['file.clp'],
|
||||||
\ 'jgraph': ['file.jgr'],
|
\ 'jgraph': ['file.jgr'],
|
||||||
|
@ -24,6 +24,10 @@ func Test_let()
|
|||||||
let out = execute('let a {0 == 1 ? "a" : "b"}')
|
let out = execute('let a {0 == 1 ? "a" : "b"}')
|
||||||
let s = "\na #1\nb #2"
|
let s = "\na #1\nb #2"
|
||||||
call assert_equal(s, out)
|
call assert_equal(s, out)
|
||||||
|
|
||||||
|
let x = 0
|
||||||
|
if 0 | let x = 1 | endif
|
||||||
|
call assert_equal(0, x)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func s:set_arg1(a) abort
|
func s:set_arg1(a) abort
|
||||||
|
Loading…
Reference in New Issue
Block a user