Christian Brabandt | 4f174f0 | 2023-11-04 11:16:23 +0100 | [diff] [blame] | 1 | " 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 Knoble | cd8a3ea | 2023-11-04 05:11:17 -0400 | [diff] [blame] | 7 | |
D. Ben Knoble | cd8a3ea | 2023-11-04 05:11:17 -0400 | [diff] [blame] | 8 | |
Christian Brabandt | 4f174f0 | 2023-11-04 11:16:23 +0100 | [diff] [blame] | 9 | " enable the zip and gzip plugin by default, if not set |
| 10 | if !exists('g:zip_exec') |
| 11 | let g:zip_exec = 1 |
| 12 | endif |
D. Ben Knoble | cd8a3ea | 2023-11-04 05:11:17 -0400 | [diff] [blame] | 13 | |
Christian Brabandt | 4f174f0 | 2023-11-04 11:16:23 +0100 | [diff] [blame] | 14 | if !exists('g:gzip_exec') |
| 15 | let g:gzip_exec = 1 |
| 16 | endif |
| 17 | |
| 18 | if !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 |
| 26 | else |
| 27 | def dist#vim#IsSafeExecutable(filetype: string, executable: string): bool |
| 28 | return dist#vim9#IsSafeExecutable(filetype, executable) |
| 29 | enddef |
| 30 | endif |