From 9a0d3b1514f1fb8620726bf08f6e574566d6bcde Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 13 Nov 2017 22:09:38 +1300 Subject: Check for shellescape() function before using it It was added in patch 111 for Vim 7.0. --- vim/plugin/auto_swapdir.vim | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'vim/plugin/auto_swapdir.vim') diff --git a/vim/plugin/auto_swapdir.vim b/vim/plugin/auto_swapdir.vim index b5f9ce3a..52ccbf11 100644 --- a/vim/plugin/auto_swapdir.vim +++ b/vim/plugin/auto_swapdir.vim @@ -32,12 +32,14 @@ if !isdirectory(expand(s:swapdir)) " Failing that, use an OS-dependent command " (Fortunately, Unix and Windows are the only OS types in the world) - elseif has('unix') - silent! execute '!mkdir -m 0700 -p ' - \ . shellescape(expand(s:swapdir)) - elseif has('win32') || has('win64') - silent! execute '!mkdir ' - \ . shellescape(expand(s:swapdir)) + elseif has('*shellescape') + if has('unix') + silent! execute '!mkdir -m 0700 -p ' + \ . shellescape(expand(s:swapdir)) + elseif has('win32') || has('win64') + silent! execute '!mkdir ' + \ . shellescape(expand(s:swapdir)) + endif endif endif -- cgit v1.2.3 From d30b6a744d9de88bde1a5d4cddf873c867f5c3d2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 13 Nov 2017 22:26:07 +1300 Subject: Strip trailing whitespace --- vim/plugin/auto_swapdir.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vim/plugin/auto_swapdir.vim') diff --git a/vim/plugin/auto_swapdir.vim b/vim/plugin/auto_swapdir.vim index b5f9ce3a..4fa209c1 100644 --- a/vim/plugin/auto_swapdir.vim +++ b/vim/plugin/auto_swapdir.vim @@ -18,7 +18,7 @@ else " This is imperfect in that it will break if you have a backslashed comma in " the first component of your &runtimepath, but if you're doing that, you " probably already have way bigger problems - let s:swapdir + let s:swapdir \ = strpart(&runtimepath, 0, stridx(&runtimepath, ',')) \ . '/swap' endif @@ -33,10 +33,10 @@ if !isdirectory(expand(s:swapdir)) " Failing that, use an OS-dependent command " (Fortunately, Unix and Windows are the only OS types in the world) elseif has('unix') - silent! execute '!mkdir -m 0700 -p ' + silent! execute '!mkdir -m 0700 -p ' \ . shellescape(expand(s:swapdir)) elseif has('win32') || has('win64') - silent! execute '!mkdir ' + silent! execute '!mkdir ' \ . shellescape(expand(s:swapdir)) endif -- cgit v1.2.3