Mercurial > vim
changeset 21707:8e224527391e v8.2.1403
patch 8.2.1403: Vim9: Vim highlighting may fail in cmdline window
Commit: https://github.com/vim/vim/commit/3896a105eb3697b1a399255ac31c742c8840bd69
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 9 14:33:55 2020 +0200
patch 8.2.1403: Vim9: Vim highlighting may fail in cmdline window
Problem: Vim9: Vim highlighting fails in cmdline window if it uses Vim9
commands.
Solution: Allow using :vim9script, :import and :export while in the cmdline
window. (closes #6656)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Aug 2020 14:45:03 +0200 |
parents | c4432bef334d |
children | e47326f0192a |
files | src/ex_cmds.h src/testdir/test_vim9_script.vim src/version.c |
diffstat | 3 files changed, 36 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -572,7 +572,7 @@ EXCMD(CMD_exit, "exit", ex_exit, EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_FILE1|EX_ARGOPT|EX_DFLALL|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_LINES), EXCMD(CMD_export, "export", ex_export, - EX_EXTRA|EX_NOTRLCOM|EX_LOCK_OK, + EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_exusage, "exusage", ex_exusage, EX_TRLBAR, @@ -698,7 +698,7 @@ EXCMD(CMD_imenu, "imenu", ex_menu, EX_RANGE|EX_ZEROR|EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK, ADDR_OTHER), EXCMD(CMD_import, "import", ex_import, - EX_EXTRA|EX_NOTRLCOM|EX_LOCK_OK, + EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_inoremap, "inoremap", ex_map, EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK, @@ -1670,7 +1670,7 @@ EXCMD(CMD_vimgrepadd, "vimgrepadd", ex_v EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE, ADDR_OTHER), EXCMD(CMD_vim9script, "vim9script", ex_vim9script, - EX_LOCK_OK, + EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_viusage, "viusage", ex_viusage, EX_TRLBAR,
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -3009,6 +3009,37 @@ def Test_vim9_autoload() &rtp = save_rtp enddef +def Test_cmdline_win() + # if the Vim syntax highlighting uses Vim9 constructs they can be used from + # the command line window. + mkdir('rtp/syntax', 'p') + let export_lines =<< trim END + vim9script + export let That = 'yes' + END + writefile(export_lines, 'rtp/syntax/Xexport.vim') + let import_lines =<< trim END + vim9script + import That from './Xexport.vim' + END + writefile(import_lines, 'rtp/syntax/vim.vim') + let save_rtp = &rtp + &rtp = getcwd() .. '/rtp' .. ',' .. &rtp + syntax on + augroup CmdWin + autocmd CmdwinEnter * g:got_there = 'yes' + augroup END + # this will open and also close the cmdline window + feedkeys('q:', 'xt') + assert_equal('yes', g:got_there) + + augroup CmdWin + au! + augroup END + &rtp = save_rtp + delete('rtp', 'rf') +enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new