summaryrefslogtreecommitdiffstats
path: root/runtime/macros/editexisting.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/macros/editexisting.vim')
-rw-r--r--runtime/macros/editexisting.vim9
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/macros/editexisting.vim b/runtime/macros/editexisting.vim
index fb6b9193fe..07c55f675e 100644
--- a/runtime/macros/editexisting.vim
+++ b/runtime/macros/editexisting.vim
@@ -1,6 +1,6 @@
" Vim Plugin: Edit the file with an existing Vim if possible
" Maintainer: Bram Moolenaar
-" Last Change: 2007 Mar 17
+" Last Change: 2008 May 29
" This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
" $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you
@@ -13,6 +13,9 @@
" 2. When a file is edited and a swap file exists for it, try finding that
" other Vim and bring it to the foreground. Requires Vim 7, because it
" uses the SwapExists autocommand event.
+if v:version < 700
+ finish
+endif
" Function that finds the Vim instance that is editing "filename" and brings
" it to the foreground.
@@ -102,8 +105,10 @@ func! EditExisting(fname, command)
if winnr > 0
exe winnr . "wincmd w"
+ elseif exists('*fnameescape')
+ exe "split " . fnameescape(a:fname)
else
- exe "split " . escape(a:fname, ' #%"|')
+ exe "split " . escape(a:fname, " \t\n*?[{`$\\%#'\"|!<")
endif
if a:command != ''