diff runtime/autoload/zip.vim @ 33196:8bc48ca90534

runtime(ftplugin): allow to exec if curdir is in PATH Commit: https://github.com/vim/vim/commit/67c951df4c95981c716eeedb1b102d9668549e65 Author: Anton Sharonov <anton.sharonov@gmail.com> Date: Tue Sep 5 21:03:27 2023 +0200 runtime(ftplugin): allow to exec if curdir is in PATH In case the current directory is present as valid $PATH entry, it is OK to call the program from it, even if vim curdir is in that same directory. (Without that patch, for instance, you will not be able to open .zip files while your current directory is /bin) closes: #13027 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 05 Sep 2023 21:15:03 +0200
parents 828bcb1a37e7
children bd3ee5abdd7a
line wrap: on
line diff
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -57,10 +57,15 @@ if !exists("g:zip_extractcmd")
  let g:zip_extractcmd= g:zip_unzipcmd
 endif
 
-if fnamemodify(exepath(g:zip_unzipcmd), ":p:h") ==# getcwd()
+let s:tmp_cwd = getcwd()
+if (fnamemodify(exepath(g:zip_unzipcmd), ":p:h") ==# getcwd()
+          \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.'))
+ unlet s:tmp_cwd
  echoerr "Warning: NOT executing " .. g:zip_unzipcmd .. " from current directory!"
  finish
 endif
+unlet s:tmp_cwd
+
 " ----------------
 "  Functions: {{{1
 " ----------------