From afce081b90c1e2c50c3507758c7558a0dfa1f33e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 15:18:03 +0200 Subject: Adding upstream version 2:8.2.2434. Signed-off-by: Daniel Baumann --- runtime/menu.vim | 1213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1213 insertions(+) create mode 100644 runtime/menu.vim (limited to 'runtime/menu.vim') diff --git a/runtime/menu.vim b/runtime/menu.vim new file mode 100644 index 0000000..e176524 --- /dev/null +++ b/runtime/menu.vim @@ -0,0 +1,1213 @@ +" 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 +" Last Change: 2020 Sep 28 + +" 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 +" 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 :help +an 9999.20 &Help.&User\ Manual :help usr_toc +an 9999.30 &Help.&How-To\ Links :help how-to +an 9999.40 &Help.&Find\.\.\. :call Helpfind() +an 9999.45 &Help.-sep1- +an 9999.50 &Help.&Credits :help credits +an 9999.60 &Help.Co&pying :help copying +an 9999.70 &Help.&Sponsor/Register :help sponsor +an 9999.70 &Help.O&rphans :help kcc +an 9999.75 &Help.-sep2- +an 9999.80 &Help.&Version :version +an 9999.90 &Help.&About :intro + +if exists(':tlmenu') + tlnoremenu 9999.10 &Help.&Overview :help + tlnoremenu 9999.20 &Help.&User\ Manual :help usr_toc + tlnoremenu 9999.30 &Help.&How-To\ Links :help how-to + tlnoremenu 9999.40 &Help.&Find\.\.\. :call Helpfind() + tlnoremenu 9999.45 &Help.-sep1- + tlnoremenu 9999.50 &Help.&Credits :help credits + tlnoremenu 9999.60 &Help.Co&pying :help copying + tlnoremenu 9999.70 &Help.&Sponsor/Register :help sponsor + tlnoremenu 9999.70 &Help.O&rphans :help kcc + tlnoremenu 9999.75 &Help.-sep2- + tlnoremenu 9999.80 &Help.&Version :version + tlnoremenu 9999.90 &Help.&About :intro +endif + +fun! s:Helpfind() + if !exists("g:menutrans_help_dialog") + let 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_)\nPrepend ' for an option name (e.g.: 'shiftwidth')" + endif + let h = inputdialog(g:menutrans_help_dialog) + if h != "" + let v:errmsg = "" + silent! exe "help " . h + if v:errmsg != "" + echo v:errmsg + endif + endif +endfun + +" File menu +an 10.310 &File.&Open\.\.\.:e :browse confirm e +an 10.320 &File.Sp&lit-Open\.\.\.:sp :browse sp +an 10.320 &File.Open\ Tab\.\.\.:tabnew :browse tabnew +an 10.325 &File.&New:enew :confirm enew +an 10.330 &File.&Close:close + \ :if winheight(2) < 0 && tabpagewinnr(2) == 0 + \ confirm enew + \ else + \ confirm close + \ endif +an 10.335 &File.-SEP1- +an 10.340 &File.&Save:w :if expand("%") == ""browse confirm welseconfirm wendif +an 10.350 &File.Save\ &As\.\.\.:sav :browse confirm saveas + +if has("diff") + an 10.400 &File.-SEP2- + an 10.410 &File.Split\ &Diff\ With\.\.\. :browse vert diffsplit + an 10.420 &File.Split\ Patched\ &By\.\.\. :browse vert diffpatch +endif + +if has("printer") + an 10.500 &File.-SEP3- + an 10.510 &File.&Print :hardcopy + vunmenu &File.&Print + vnoremenu &File.&Print :hardcopy +elseif has("unix") + an 10.500 &File.-SEP3- + an 10.510 &File.&Print :w !lpr + vunmenu &File.&Print + vnoremenu &File.&Print :w !lpr +endif +an 10.600 &File.-SEP4- +an 10.610 &File.Sa&ve-Exit:wqa :confirm wqa +an 10.620 &File.E&xit:qa :confirm qa + +func s:SelectAll() + exe "norm! gg" . (&slm == "" ? "VG" : "gH\G") +endfunc + +func s:FnameEscape(fname) + if exists('*fnameescape') + return fnameescape(a:fname) + endif + return escape(a:fname, " \t\n*?[{`$\\%#'\"|!<") +endfunc + +" Edit menu +an 20.310 &Edit.&Undou u +an 20.320 &Edit.&Redo^R +an 20.330 &Edit.Rep&eat\. . + +an 20.335 &Edit.-SEP1- +vnoremenu 20.340 &Edit.Cu&t"+x "+x +vnoremenu 20.350 &Edit.&Copy"+y "+y +cnoremenu 20.350 &Edit.&Copy"+y +if exists(':tlmenu') + tlnoremenu 20.350 &Edit.&Copy"+y : +endif +nnoremenu 20.360 &Edit.&Paste"+gP "+gP +cnoremenu &Edit.&Paste"+gP + +if exists(':tlmenu') + tlnoremenu &Edit.&Paste"+gP "+ +endif +exe 'vnoremenu