" 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: 2005 Jul 21
" 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"
if strlen(s:lang) > 1
" 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") && 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>
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_<Del>)\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\.\.\.<Tab>:e :browse confirm e<CR>
an 10.320 &File.Sp&lit-Open\.\.\.<Tab>:sp :browse sp<CR>
an 10.325 &File.&New<Tab>:enew :confirm enew<CR>
an <silent> 10.330 &File.&Close<Tab>:close
\ :if winheight(2) < 0 <Bar>
\ confirm enew <Bar>
\ else <Bar>
\ confirm close <Bar>
\ endif<CR>
an 10.335 &File.-SEP1- <Nop>
an <silent> 10.340 &File.&Save<Tab>:w :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR>
an 10.350 &File.Save\ &As\.\.\.<Tab>:sav :browse confirm saveas<CR>
if has("diff")
an 10.400 &File.-SEP2- <Nop>
an 10.410 &File.Split\ &Diff\ with\.\.\. :browse vert diffsplit<CR>
an 10.420 &File.Split\ Patched\ &By\.\.\. :browse vert diffpatch<CR>
endif
if has("printer")
an 10.500 &File.-SEP3- <Nop>
an 10.510 &File.&Print :hardcopy<CR>
vunmenu &File.&Print
vnoremenu &File.&Print :hardcopy<CR>
elseif has("unix")
an 10.500 &File.-SEP3- <Nop>
an 10.510 &File.&Print :w !lpr<CR>
vunmenu &File.&Print
vnoremenu &File.&Print :w !lpr<CR>
endif
an 10.600 &File.-SEP4- <Nop>
an 10.610 &File.Sa&ve-Exit<Tab>:wqa :confirm wqa<CR>
an 10.620 &File.E&xit<Tab>:qa :confirm qa<CR>
" Pasting blockwise and linewise selections is not possible in Insert and
" Visual mode without the +virtualedit feature. They are pasted as if they
" were characterwise instead. Add to that some tricks to leave the cursor in
" the right position, also for "gi".
" Note: the same stuff appears in mswin.vim.
if has("virtualedit")
let s:paste_cmd = ":call <SID>Paste()<CR>"
func! <SID>Paste()
let ove = &ve
set ve=all
normal `^
if @+ != ''
normal "+gP
endif
let c = col(".")
normal i
if col(".") < c " compensate for i<ESC> moving the cursor left
normal l
endif
let &ve = ove
endfunc
else
let s:paste_cmd = "\"=@+.'xy'<CR>gPFx\"_2x"
endif
" Define