diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
commit | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch) | |
tree | d8c1843a95da5ea0bb4acc09f7e37843d9995c86 /runtime/ftplugin/ruby.vim | |
parent | 142d9041391780ac15b89886a54015fdc5c73995 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-userreg.tar.gz rneovim-userreg.tar.bz2 rneovim-userreg.zip |
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'runtime/ftplugin/ruby.vim')
-rw-r--r-- | runtime/ftplugin/ruby.vim | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim index 8c1f47731c..b61c1765d9 100644 --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -3,7 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2022 Mar 21 +" Last Change: 2023 Sep 1st if (exists("b:did_ftplugin")) finish @@ -61,6 +61,10 @@ if !exists('g:ruby_version_paths') endif function! s:query_path(root) abort + " Disabled by default for security reasons. + if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) + return [] + endif let code = "print $:.join %q{,}" if &shell =~# 'sh' && empty(&shellxquote) let prefix = 'env PATH='.shellescape($PATH).' ' @@ -77,7 +81,14 @@ function! s:query_path(root) abort let cwd = fnameescape(getcwd()) try exe cd fnameescape(a:root) - let path = split(system(path_check),',') + 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 |