aboutsummaryrefslogtreecommitdiff
path: root/runtime/menu.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/menu.vim')
-rw-r--r--runtime/menu.vim31
1 files changed, 19 insertions, 12 deletions
diff --git a/runtime/menu.vim b/runtime/menu.vim
index cd56eb5583..701dd33cdd 100644
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -2,7 +2,7 @@
" You can also use this as a start for your own set of menus.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2019 Jan 27
+" Last Change: 2019 Dec 10
" 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.
@@ -29,7 +29,8 @@ if exists("v:lang") || &langmenu != ""
let s:lang = v:lang
endif
" A language name must be at least two characters, don't accept "C"
- if strlen(s:lang) > 1
+ " 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
@@ -158,6 +159,9 @@ an 20.335 &Edit.-SEP1- <Nop>
vnoremenu 20.340 &Edit.Cu&t<Tab>"+x "+x
vnoremenu 20.350 &Edit.&Copy<Tab>"+y "+y
cnoremenu 20.350 &Edit.&Copy<Tab>"+y <C-Y>
+if exists(':tlmenu')
+ tlnoremenu 20.350 &Edit.&Copy<Tab>"+y <C-W>:<C-Y><CR>
+endif
nnoremenu 20.360 &Edit.&Paste<Tab>"+gP "+gP
cnoremenu &Edit.&Paste<Tab>"+gP <C-R>+
exe 'vnoremenu <script> &Edit.&Paste<Tab>"+gP ' . paste#paste_cmd['v']
@@ -446,12 +450,12 @@ if has("spell")
an 40.335.260 &Tools.&Spelling.Set\ Language\ to\ "en_us" :set spl=en_us spell<CR>
an <silent> 40.335.270 &Tools.&Spelling.&Find\ More\ Languages :call <SID>SpellLang()<CR>
- let s:undo_spellang = ['aun &Tools.&Spelling.&Find\ More\ Languages']
+ let s:undo_spelllang = ['aun &Tools.&Spelling.&Find\ More\ Languages']
func! s:SpellLang()
- for cmd in s:undo_spellang
+ for cmd in s:undo_spelllang
exe "silent! " . cmd
endfor
- let s:undo_spellang = []
+ let s:undo_spelllang = []
if &enc == "iso-8859-15"
let enc = "latin1"
@@ -474,7 +478,7 @@ if has("spell")
let found += 1
let menuname = '&Tools.&Spelling.' . escape(g:menutrans_set_lang_to, "\\. \t|") . '\ "' . nm . '"'
exe 'an 40.335.' . n . ' ' . menuname . ' :set spl=' . nm . ' spell<CR>'
- let s:undo_spellang += ['aun ' . menuname]
+ let s:undo_spelllang += ['aun ' . menuname]
endif
let n += 10
endfor
@@ -565,7 +569,7 @@ func! s:XxdConv()
%!mc vim:xxd
else
call s:XxdFind()
- exe '%!"' . g:xxdprogram . '"'
+ exe '%!' . g:xxdprogram
endif
if getline(1) =~ "^0000000:" " only if it worked
set ft=xxd
@@ -579,7 +583,7 @@ func! s:XxdBack()
%!mc vim:xxd -r
else
call s:XxdFind()
- exe '%!"' . g:xxdprogram . '" -r'
+ exe '%!' . g:xxdprogram . ' -r'
endif
set ft=
doautocmd filetypedetect BufReadPost
@@ -591,6 +595,9 @@ func! s:XxdFind()
" On the PC xxd may not be in the path but in the install directory
if has("win32") && !executable("xxd")
let g:xxdprogram = $VIMRUNTIME . (&shellslash ? '/' : '\') . "xxd.exe"
+ if g:xxdprogram =~ ' '
+ let g:xxdprogram = '"' .. g:xxdprogram .. '"'
+ endif
else
let g:xxdprogram = "xxd"
endif
@@ -690,11 +697,11 @@ func! s:BMShow(...)
let g:bmenu_priority = a:1
endif
- " remove old menu, if exists; keep one entry to avoid a torn off menu to
- " disappear.
- silent! unmenu &Buffers
+ " Remove old menu, if exists; keep one entry to avoid a torn off menu to
+ " disappear. Use try/catch to avoid setting v:errmsg
+ try | unmenu &Buffers | catch | endtry
exe 'noremenu ' . g:bmenu_priority . ".1 &Buffers.Dummy l"
- silent! unmenu! &Buffers
+ try | unmenu! &Buffers | catch | endtry
" create new menu; set 'cpo' to include the <CR>
let cpo_save = &cpo