blob: d5a8984dc665f2b92d77ef013d60aec2406f5b70 [file] [log] [blame]
Christian Brabandt4f174f02023-11-04 11:16:23 +01001" Vim runtime support library,
2" runs the vim9 script version or legacy script version
3" on demand (mostly for Neovim compatability)
4"
5" Maintainer: The Vim Project <https://github.com/vim/vim>
6" Last Change: 2023 Nov 04
D. Ben Knoblecd8a3ea2023-11-04 05:11:17 -04007
D. Ben Knoblecd8a3ea2023-11-04 05:11:17 -04008
Christian Brabandt4f174f02023-11-04 11:16:23 +01009" enable the zip and gzip plugin by default, if not set
10if !exists('g:zip_exec')
11 let g:zip_exec = 1
12endif
D. Ben Knoblecd8a3ea2023-11-04 05:11:17 -040013
Christian Brabandt4f174f02023-11-04 11:16:23 +010014if !exists('g:gzip_exec')
15 let g:gzip_exec = 1
16endif
17
18if !exists(":def")
19 function dist#vim#IsSafeExecutable(filetype, executable)
20 let cwd = getcwd()
21 return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) &&
22 \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd
23 \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 &&
24 \ cwd != '.'))
25 endfunction
26else
27 def dist#vim#IsSafeExecutable(filetype: string, executable: string): bool
28 return dist#vim9#IsSafeExecutable(filetype, executable)
29 enddef
30endif