vim.vim (966B)
1 " Vim runtime support library, 2 " runs the Vim9 script version or legacy script version 3 " on demand (mostly for Neovim compatibility) 4 " 5 " Maintainer: The Vim Project <https://github.com/vim/vim> 6 " Last Change: 2026 Jan 11 7 8 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 13 14 if !exists('g:gzip_exec') 15 let g:gzip_exec = 1 16 endif 17 18 if !has('vim9script') 19 function dist#vim#IsSafeExecutable(filetype, executable) 20 let cwd = getcwd() 21 if empty(exepath(a:executable)) 22 return v:false 23 endif 24 return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) && 25 \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd 26 \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 && 27 \ cwd != '.')) 28 endfunction 29 30 finish 31 endif 32 33 def dist#vim#IsSafeExecutable(filetype: string, executable: string): bool 34 return dist#vim9#IsSafeExecutable(filetype, executable) 35 enddef