0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

runtime(vim): Update base-syntax, improve :echo and :execute highlighting (#14199)

Improve :echo and :execute highlighting.

- Add better line-continuation support for both commands.
- Improve the :execute command's expression argument matching.
- Remove the fix for issue #9987 as this is now handled by correctly
  matching the parens in :echo (...) as operator parens.


Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
dkearns
2024-03-15 23:45:48 +11:00
committed by GitHub
parent c35fc03dbd
commit 61887b3d6f
16 changed files with 293 additions and 80 deletions

View File

@@ -2,8 +2,8 @@
" Language: Vim script
" Maintainer: Hirohito Higashi (h_east)
" URL: https://github.com/vim-jp/syntax-vim-ex
" Last Change: 2024 Mar 09
" Version: 2.0.5
" Last Change: 2024 Mar 14
" Version: 2.0.6
let s:keepcpo= &cpo
set cpo&vim
@@ -264,23 +264,21 @@ function! s:get_vim_command_type(cmd_name)
" Return value:
" 0: normal
" 1: (Reserved)
" 2: abbrev
" 3: echo
" 4: menu
" 5: map
" 6: mapclear
" 7: unmap
" 2: abbrev (without un)
" 3: menu
" 4: map
" 5: mapclear
" 6: unmap
" 99: (Exclude registration of "syn keyword")
let menu_prefix = '^\%([acinostvx]\?\|tl\)'
let map_prefix = '^[acilnostvx]\?'
let echo_suffix = '\%(n\|hl\|msg\|window\|err\|console\|\)$'
let exclude_list = [
\ 'map', 'mapclear',
\ 'substitute', 'smagic', 'snomagic',
\ 'setlocal', 'setglobal', 'set', 'var',
\ 'autocmd', 'augroup', 'doautocmd', 'doautoall',
\ 'echohl',
\ 'execute',
\ 'echo', 'echoconsole', 'echoerr', 'echohl', 'echomsg', 'echon', 'echowindow',
\ 'execute',
\ 'behave', 'augroup', 'normal', 'syntax',
\ 'append', 'insert',
\ 'Next', 'Print', 'X',
@@ -293,16 +291,14 @@ function! s:get_vim_command_type(cmd_name)
let ret = 99
elseif a:cmd_name =~# '^\%(\%(un\)\?abbreviate\|noreabbrev\|\l\%(nore\|un\)\?abbrev\)$'
let ret = 2
elseif a:cmd_name =~# '^echo' . echo_suffix
let ret = 3
elseif a:cmd_name =~# menu_prefix . '\%(nore\|un\)\?menu$'
let ret = 4
let ret = 3
elseif a:cmd_name =~# map_prefix . '\%(nore\)\?map$'
let ret = 5
let ret = 4
elseif a:cmd_name =~# map_prefix . 'mapclear$'
let ret = 6
let ret = 5
elseif a:cmd_name =~# map_prefix . 'unmap$'
let ret = 7
let ret = 6
else
let ret = 0
endif
@@ -621,19 +617,16 @@ function! s:update_syntax_vim_file(vim_info)
let li = a:vim_info.cmd
let lnum = s:search_and_check(kword . ' abbrev', base_fname, str_info)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 2)
" vimCommand - echo
let lnum = s:search_and_check(kword . ' echo', base_fname, str_info)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3)
" vimCommand - menu
let lnum = s:search_and_check(kword . ' menu', base_fname, str_info)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4)
" vimCommand - map
let lnum = s:search_and_check(kword . ' map', base_fname, str_info)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4)
let lnum = s:search_and_check(kword . ' mapclear', base_fname, str_info)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5)
let lnum = s:search_and_check(kword . ' unmap', base_fname, str_info)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 7)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6)
" vimCommand - menu
let lnum = s:search_and_check(kword . ' menu', base_fname, str_info)
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3)
update
quit!