" Vim support file to define the default menus
" You can also use this as a start for your own set of menus.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2022 Nov 27
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
" in all modes and avoid side effects from mappings defined by the user.
" Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise
" <CR> would not be recognized. See ":help 'cpoptions'".
let s:cpo_save = &cpo
set cpo&vim
" Avoid installing the menus twice
if !exists("did_install_default_menus")
let did_install_default_menus = 1
if exists("v:lang") || &langmenu != ""
" Try to find a menu translation file for the current language.
if &langmenu != ""
if &langmenu =~ "none"
let s:lang = ""
else
let s:lang = &langmenu
endif
else
let s:lang = v:lang
endif
" A language name must be at least two characters, don't accept "C"
" Also skip "en_US" to avoid picking up "en_gb" translations.
if strlen(s:lang) > 1 && s:lang !~? '^en_us'
" When the language does not include the charset add 'encoding'
if s:lang =~ '^\a\a$\|^\a\a_\a\a$'
let s:lang = s:lang .. '.' .. &enc
endif
" We always use a lowercase name.
" Change "iso-8859" to "iso_8859" and "iso8859" to "iso_8859", some
" systems appear to use this.
" Change spaces to underscores.
let s:lang = substitute(tolower(s:lang), '\.iso-', ".iso_", "")
let s:lang = substitute(s:lang, '\.iso8859', ".iso_8859", "")
let s:lang = substitute(s:lang, " ", "_", "g")
" Remove "@euro", otherwise "LC_ALL=de_DE@euro gvim" will show English menus
let s:lang = substitute(s:lang, "@euro", "", "")
" Change "iso_8859-1" and "iso_8859-15" to "latin1", we always use the
" same menu file for them.
let s:lang = substitute(s:lang, 'iso_8859-15\=$', "latin1", "")
menutrans clear
exe "runtime! lang/menu_" .. s:lang .. ".vim"
if !exists("did_menu_trans")
" There is no exact match, try matching with a wildcard added
" (e.g. find menu_de_de.iso_8859-1.vim if s:lang == de_DE).
let s:lang = substitute(s:lang, '\.[^.]*', "", "")
exe "runtime! lang/menu_" .. s:lang .. "[^a-z]*vim"
if !exists("did_menu_trans") && s:lang =~ '_'
" If the language includes a region try matching without that region.
" (e.g. find menu_de.vim if s:lang == de_DE).
let langonly = substitute(s:lang, '_.*', "", "")
exe "runtime! lang/menu_" .. langonly .. "[^a-z]*vim"
endif
if !exists("did_menu_trans") && strlen($LANG) > 1 && s:lang !~ '^en_us'
" On windows locale names are complicated, try using $LANG, it might
" have been set by set_init_1(). But don't do this for "en" or "en_us".
" But don't match "slovak" when $LANG is "sl".
exe "runtime! lang/menu_" .. tolower($LANG) .. "[^a-z]*vim"
endif
endif
endif
endif
" Help menu
an 9999.10 &Help.&Overview<Tab><F1> :help<CR>
an 9999.20 &Help.&User\ Manual :help usr_toc<CR>
an 9999.30 &Help.&How-To\ Links :help how-to<CR>
an <silent> 9999.40 &Help.&Find\.\.\. :call <SID>Helpfind()<CR>
an 9999.45 &Help.-sep1- <Nop>
an 9999.50 &Help.&Credits :help credits<CR>
an 9999.60 &Help.Co&pying :help copying<CR>
an 9999.70 &Help.&Sponsor/Register :help sponsor<CR>
an 9999.70 &Help.O&rphans :help kcc<CR>
an 9999.75 &Help.-sep2- <Nop>
an 9999.80 &Help.&Version :version<CR>
an 9999.90 &Help.&About :intro<CR>
if exists(':tlmenu')
tlnoremenu 9999.10 &Help.&Overview<Tab><F1> <C-W>:help<CR>
tlnoremenu 9999.20 &Help.&User\ Manual <C-W>:help usr_toc<CR>
tlnoremenu 9999.30 &Help.&How-To\ Links <C-W>:help how-to<CR>
tlnoremenu <silent> 9999.40 &Help.&Find\.\.\. <C-W>:call <SID>Helpfind()<CR>
tlnoremenu 9999.45 &Help.-sep1- <Nop>
tlnoremenu 9999.50 &Help.&Credits <C-W>:help credits<CR>
tlnoremenu 9999.60 &Help.Co&pying <C-W>:help copying<CR>
tlnoremenu 9999.70 &Help.&Sponsor/Register <C-W>:help sponsor<CR>
tlnoremenu 9999.70 &Help.O&rphans <C-W>:help kcc<CR>
tlnoremenu 9999.75 &Help.-sep2- <Nop>
tlnoremenu 9999.80 &Help.&Version <C-W>:version<CR>
tlnoremenu 9999.90 &Help.&About <C-W>:intro<CR>
endif
def s:Helpfind()
if !exists("g:menutrans_help_dialog")
g:menutrans_help_dialog = "Enter a command or word to find help on:\n\nPrepend i_ for Input mode commands (e.g.: i_CTRL-X)\nPrepend c_ for command-line editing commands (e.g.: c_<Del>)\nPrepend ' for an option name (e.g.: 'shiftwidth')"
endif
var h = inputdialog(g:menutrans_help_dialog)
if h != ""
v:errmsg = ""
silent! e