summaryrefslogtreecommitdiffstats
path: root/runtime/ftplugin/ruby.vim
diff options
context:
space:
mode:
authorAnton Sharonov <anton.sharonov@gmail.com>2023-09-05 21:03:27 +0200
committerChristian Brabandt <cb@256bit.org>2023-09-05 21:04:44 +0200
commit67c951df4c95981c716eeedb1b102d9668549e65 (patch)
tree0f93ebab97af475da31db8f38077e88efc87a711 /runtime/ftplugin/ruby.vim
parent9b04c503197af07dad3c4fe4348acd9150f3a715 (diff)
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>
Diffstat (limited to 'runtime/ftplugin/ruby.vim')
-rw-r--r--runtime/ftplugin/ruby.vim5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim
index daffe1e0dc..a424801cd1 100644
--- a/runtime/ftplugin/ruby.vim
+++ b/runtime/ftplugin/ruby.vim
@@ -77,11 +77,14 @@ function! s:query_path(root) abort
let cwd = fnameescape(getcwd())
try
exe cd fnameescape(a:root)
- if fnamemodify(exepath('ruby'), ':p:h') ==# cwd
+ let s:tmp_cwd = getcwd()
+ if (fnamemodify(exepath('ruby'), ':p:h') ==# cwd
+ \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.'))
let path = []
else
let path = split(system(path_check),',')
endif
+ unlet s:tmp_cwd
exe cd cwd
return path
finally