diff options
Diffstat (limited to 'runtime/menu.vim')
-rw-r--r-- | runtime/menu.vim | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/runtime/menu.vim b/runtime/menu.vim index f0c0d699c5..d120ce293b 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: 2007 Nov 19 +" Last Change: 2008 Jun 16 " 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. @@ -135,6 +135,11 @@ func! <SID>SelectAll() exe "norm gg" . (&slm == "" ? "VG" : "gH\<C-O>G") endfunc +func! s:FnameEscape(fname) + if exists('*fnameescape') + return fnameescape(a:fname) + return escape(a:fname, " \t\n*?[{`$\\%#'\"|!<") +endfunc " Edit menu an 20.310 &Edit.&Undo<Tab>u u @@ -193,6 +198,7 @@ fun! s:EditVimrc() else let fname = "$HOME/.vimrc" endif + let fname = s:FnameEscape(fname) if &mod exe "split " . fname else @@ -806,7 +812,7 @@ if has("vertsplit") if @% == "" 20vsp . else - exe "20vsp " . expand("%:p:h") + exe "20vsp " . s:FnameEscape(expand("%:p:h")) endif endfun endif @@ -1028,7 +1034,7 @@ endif " Select a session to load; default to current session name if present fun! s:LoadVimSesn() if strlen(v:this_session) > 0 - let name = escape(v:this_session, ' \t#%$|<>"*?[{`') + let name = s:FnameEscape(v:this_session) else let name = "Session.vim" endif @@ -1040,7 +1046,7 @@ fun! s:SaveVimSesn() if strlen(v:this_session) == 0 let v:this_session = "Session.vim" endif - execute "browse mksession! " . escape(v:this_session, ' \t#%$|<>"*?[{`') + execute "browse mksession! " . s:FnameEscape(v:this_session) endfun endif |