vim.vim 966 B

123456789101112131415161718192021222324252627282930313233343536
  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
  7. " enable the zip and gzip plugin by default, if not set
  8. if !exists('g:zip_exec')
  9. let g:zip_exec = 1
  10. endif
  11. if !exists('g:gzip_exec')
  12. let g:gzip_exec = 1
  13. endif
  14. if !has('vim9script')
  15. function dist#vim#IsSafeExecutable(filetype, executable)
  16. let cwd = getcwd()
  17. if empty(exepath(a:executable))
  18. return v:false
  19. endif
  20. return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) &&
  21. \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd
  22. \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 &&
  23. \ cwd != '.'))
  24. endfunction
  25. finish
  26. endif
  27. def dist#vim#IsSafeExecutable(filetype: string, executable: string): bool
  28. return dist#vim9#IsSafeExecutable(filetype, executable)
  29. enddef