runtime(vim): Update base-syntax, improve :menu{,translate} highlighting (#14162)
Improve :menu and :menutranslate highlighting.
- Match args to :menutranslation and :popup.
- Only highlight special notation in {rhs} of :menu, like :map.
- Allow line continuations in {rhs} of :menu and between {english} and
{mylang} of :menutranslation, matching common usage.
- Bug fixes.
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
73
runtime/syntax/testdir/input/vim_ex_menu.vim
Normal file
73
runtime/syntax/testdir/input/vim_ex_menu.vim
Normal file
@ -0,0 +1,73 @@
|
||||
" Vim :menu commands
|
||||
|
||||
" :help disable menus
|
||||
menu disable &File.&Open\.\.\.
|
||||
amenu enable *
|
||||
amenu disable &Tools.*
|
||||
|
||||
|
||||
" :help menu-examples
|
||||
nmenu Words.Add\ Var wb"zye:menu! Words.<C-R>z <C-R>z<CR>
|
||||
nmenu Words.Remove\ Var wb"zye:unmenu! Words.<C-R>z<CR>
|
||||
vmenu Words.Add\ Var "zy:menu! Words.<C-R>z <C-R>z <CR>
|
||||
vmenu Words.Remove\ Var "zy:unmenu! Words.<C-R>z<CR>
|
||||
imenu Words.Add\ Var <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a
|
||||
imenu Words.Remove\ Var <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a
|
||||
|
||||
|
||||
" special keys
|
||||
menu <silent> &Foo\ bar :echo "Foobar"<CR>
|
||||
menu <special> &Foo\ bar :echo "Foobar"<CR>
|
||||
menu <script> &Foo\ bar :echo "Foobar"<CR>
|
||||
menu <silent> <special> &Foo\ bar :echo "Foobar"<CR>
|
||||
menu <silent> <special> <script> &Foo\ bar :echo "Foobar"<CR>
|
||||
|
||||
|
||||
function Foo()
|
||||
menu <silent> &Foo\ bar :echo "Foobar"<CR>
|
||||
endfunction
|
||||
|
||||
|
||||
" Example: runtime/menu.vim (modified)
|
||||
an <silent> 10.330 &File.&Close<Tab>:close :confirm close<CR>
|
||||
|
||||
an <silent> 10.330 &File.&Close<Tab>:close
|
||||
\ :if winheight(2) < 0 && tabpagewinnr(2) == 0 <Bar>
|
||||
\ confirm enew <Bar>
|
||||
\ else <Bar>
|
||||
\ confirm close <Bar>
|
||||
\ endif<CR>
|
||||
|
||||
an <silent> 10.330 &File.&Close<Tab>:close
|
||||
"\ comment
|
||||
\ :if winheight(2) < 0 && tabpagewinnr(2) == 0 <Bar>
|
||||
"\ comment
|
||||
\ confirm enew <Bar>
|
||||
"\ comment
|
||||
\ else <Bar>
|
||||
"\ comment
|
||||
\ confirm close <Bar>
|
||||
"\ comment
|
||||
\ endif<CR>
|
||||
|
||||
an <silent> 10.330 &File.&Close<Tab>:close :if winheight(2) < 0 && tabpagewinnr(2) == 0 <Bar>
|
||||
\ confirm enew <Bar>
|
||||
\ else <Bar>
|
||||
\ confirm close <Bar>
|
||||
\ endif<CR>
|
||||
|
||||
an <silent> 10.330 &File.&Close<Tab>:close :if winheight(2) < 0 && tabpagewinnr(2) == 0 <Bar>
|
||||
"\ comment
|
||||
\ confirm enew <Bar>
|
||||
"\ comment
|
||||
\ else <Bar>
|
||||
"\ comment
|
||||
\ confirm close <Bar>
|
||||
"\ comment
|
||||
\ endif<CR>
|
||||
|
||||
|
||||
" popup menus
|
||||
popup &Foo | echo "Foo"
|
||||
popup! &Foo | echo "Foo"
|
||||
|
||||
51
runtime/syntax/testdir/input/vim_ex_menutranslate.vim
Normal file
51
runtime/syntax/testdir/input/vim_ex_menutranslate.vim
Normal file
@ -0,0 +1,51 @@
|
||||
" Vim :menutranslate command
|
||||
|
||||
menutranslate clear
|
||||
menutranslate clear | echo "Foo"
|
||||
menutranslate clear " comment
|
||||
|
||||
menutranslate &Foo\ bar &FuBar | echo "Foo"
|
||||
|
||||
menutranslate &Foo\ bar &FuBar " comment
|
||||
menutranslate \"&Foo"\ bar \"&FuBar
|
||||
menutranslate &Foo\ "bar" &FuBar
|
||||
|
||||
menutranslate &Foo\ bar
|
||||
\ &Fubar | echo "Foo"
|
||||
|
||||
menutranslate
|
||||
\ &Foo\ bar
|
||||
\ &Fubar | echo "Foo"
|
||||
|
||||
menutranslate
|
||||
\ &Foo\ bar
|
||||
\ &Fubar| echo "Foo"
|
||||
|
||||
menutranslate
|
||||
\ &Foo\ bar
|
||||
\ &Fubar
|
||||
\ | echo "Foo"
|
||||
|
||||
menutranslate &Foo\ bar
|
||||
"\ comment
|
||||
\ &Fubar | echo "Foo"
|
||||
|
||||
menutranslate
|
||||
"\ comment
|
||||
\ &Foo\ bar
|
||||
"\ comment
|
||||
\ &Fubar | echo "Foo"
|
||||
|
||||
menutranslate
|
||||
\ &Foo\ bar
|
||||
"\ comment
|
||||
\ &Fubar| echo "Foo"
|
||||
"\ comment
|
||||
|
||||
menutranslate
|
||||
"\ comment
|
||||
\ &Foo\ bar
|
||||
"\ comment
|
||||
\ &Fubar
|
||||
\ | echo "Foo"
|
||||
|
||||
Reference in New Issue
Block a user