0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

Update runtime files; use compiled functions

This commit is contained in:
Bram Moolenaar
2022-02-04 19:48:06 +00:00
parent a2baa73d1d
commit 3e79c97c18
7 changed files with 476 additions and 513 deletions

View File

@@ -1,52 +1,54 @@
" Script to define the syntax menu in synmenu.vim
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2019 Dec 07
vim9script
" This is used by "make menu" in the src directory.
# Script to define the syntax menu in synmenu.vim
# Maintainer: Bram Moolenaar <Bram@vim.org>
# Last Change: 2022 Feb 04
# This is used by "make menu" in the src directory.
edit <sfile>:p:h/synmenu.vim
/The Start Of The Syntax Menu/+1,/The End Of The Syntax Menu/-1d
let s:lnum = line(".") - 1
call append(s:lnum, "")
let s:lnum = s:lnum + 1
:/The Start Of The Syntax Menu/+1,/The End Of The Syntax Menu/-1d
var lnum = line(".") - 1
call append(lnum, "")
lnum += 1
" Use the SynMenu command and function to define all menu entries
command! -nargs=* SynMenu call <SID>Syn(<q-args>)
# Use the SynMenu command and function to define all menu entries
command! -nargs=* SynMenu call Syn(<q-args>)
let s:cur_menu_name = ""
let s:cur_menu_nr = 0
let s:cur_menu_item = 0
let s:cur_menu_char = ""
var cur_menu_name = ""
var cur_menu_nr = 0
var cur_menu_item = 0
var cur_menu_char = ""
fun! <SID>Syn(arg)
" isolate menu name: until the first dot
let i = match(a:arg, '\.')
let menu_name = strpart(a:arg, 0, i)
let r = strpart(a:arg, i + 1, 999)
" isolate submenu name: until the colon
let i = match(r, ":")
let submenu_name = strpart(r, 0, i)
" after the colon is the syntax name
let syntax_name = strpart(r, i + 1, 999)
def Syn(arg: string)
# isolate menu name: until the first dot
var i = match(arg, '\.')
var menu_name = strpart(arg, 0, i)
var r = strpart(arg, i + 1, 999)
# isolate submenu name: until the colon
i = match(r, ":")
var submenu_name = strpart(r, 0, i)
# after the colon is the syntax name
var syntax_name = strpart(r, i + 1, 999)
if s:cur_menu_name != menu_name
let s:cur_menu_name = menu_name
let s:cur_menu_nr = s:cur_menu_nr + 10
let s:cur_menu_item = 100
let s:cur_menu_char = submenu_name[0]
if cur_menu_name != menu_name
cur_menu_name = menu_name
cur_menu_nr += 10
cur_menu_item = 100
cur_menu_char = submenu_name[0]
else
" When starting a new letter, insert a menu separator.
let c = submenu_name[0]
# When starting a new letter, insert a menu separator.
var c = submenu_name[0]
if c != s:cur_menu_char
exe 'an 50.' . s:cur_menu_nr . '.' . s:cur_menu_item . ' &Syntax.' . menu_name . ".-" . c . '- <nul>'
let s:cur_menu_item = s:cur_menu_item + 10
let s:cur_menu_char = c
exe 'an 50.' .. s:cur_menu_nr .. '.' .. s:cur_menu_item .. ' &Syntax.' .. menu_name .. ".-" .. c .. '- <nul>'
cur_menu_item += 10
cur_menu_char = c
endif
endif
call append(s:lnum, 'an 50.' . s:cur_menu_nr . '.' . s:cur_menu_item . ' &Syntax.' . menu_name . "." . submenu_name . ' :cal SetSyn("' . syntax_name . '")<CR>')
let s:cur_menu_item = s:cur_menu_item + 10
let s:lnum = s:lnum + 1
endfun
append(lnum, 'an 50.' .. s:cur_menu_nr .. '.' .. s:cur_menu_item .. ' &Syntax.' .. menu_name .. "." .. submenu_name .. ' :cal SetSyn("' .. syntax_name .. '")<CR>')
cur_menu_item += 10
lnum += 1
enddef
SynMenu AB.A2ps\ config:a2ps
SynMenu AB.Aap:aap
@@ -676,6 +678,6 @@ SynMenu WXYZ.YAML:yaml
SynMenu WXYZ.Yacc:yacc
SynMenu WXYZ.Zimbu:zimbu
call append(s:lnum, "")
append(lnum, "")
wq