mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.1382: Vim9: using :import in filetype plugin gives an error
Problem: Vim9: using :import in filetype plugin gives an error. Solution: Allow commands with the EX_LOCK_OK flag. (closes #6636)
This commit is contained in:
@@ -2087,7 +2087,7 @@ do_one_cmd(
|
||||
// Do allow ":checktime" (it is postponed).
|
||||
// Do allow ":edit" (check for an argument later).
|
||||
// Do allow ":file" with no arguments (check for an argument later).
|
||||
if (!(ea.argt & EX_CMDWIN)
|
||||
if (!(ea.argt & (EX_CMDWIN | EX_LOCK_OK))
|
||||
&& ea.cmdidx != CMD_checktime
|
||||
&& ea.cmdidx != CMD_edit
|
||||
&& ea.cmdidx != CMD_file
|
||||
|
@@ -1381,6 +1381,36 @@ def Test_import_export_expr_map()
|
||||
nunmap trigger
|
||||
enddef
|
||||
|
||||
def Test_import_in_filetype()
|
||||
# check that :import works when the buffer is locked
|
||||
mkdir('ftplugin', 'p')
|
||||
let export_lines =<< trim END
|
||||
vim9script
|
||||
export let That = 'yes'
|
||||
END
|
||||
writefile(export_lines, 'ftplugin/Xexport_that.vim')
|
||||
|
||||
let import_lines =<< trim END
|
||||
vim9script
|
||||
import That from './Xexport_that.vim'
|
||||
assert_equal('yes', That)
|
||||
g:did_load_mytpe = 1
|
||||
END
|
||||
writefile(import_lines, 'ftplugin/qf.vim')
|
||||
|
||||
let save_rtp = &rtp
|
||||
&rtp = getcwd() .. ',' .. &rtp
|
||||
|
||||
filetype plugin on
|
||||
copen
|
||||
assert_equal(1, g:did_load_mytpe)
|
||||
|
||||
quit!
|
||||
delete('Xexport.vim')
|
||||
delete('ftplugin', 'rf')
|
||||
&rtp = save_rtp
|
||||
enddef
|
||||
|
||||
def Test_vim9script_fails()
|
||||
CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:')
|
||||
CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:')
|
||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1382,
|
||||
/**/
|
||||
1381,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user