Skip to content

Commit 4f174f0

Browse files
committed
runtime(dist): add legacy version for central vim library
Also, enable the zip and gzip plugins by default, unless those variables were not explicitly set by the user. related: #13413 Signed-off-by: Christian Brabandt <[email protected]>
1 parent cd8a3ea commit 4f174f0

2 files changed

Lines changed: 44 additions & 14 deletions

File tree

runtime/autoload/dist/vim.vim

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
vim9script
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
27

3-
# Vim runtime support library
4-
#
5-
# Maintainer: The Vim Project <https://github.com/vim/vim>
6-
# Last Change: 2023 Oct 25
78

8-
export def IsSafeExecutable(filetype: string, executable: string): bool
9-
var cwd = getcwd()
10-
return get(g:, filetype .. '_exec', get(g:, 'plugin_exec', 0))
11-
&& (fnamemodify(exepath(executable), ':p:h') !=# cwd
12-
|| (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1
13-
&& cwd != '.'))
14-
enddef
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
1513

16-
# Uncomment this line to check for compilation errors early
17-
# defcompile
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

runtime/autoload/dist/vim9.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
vim9script
2+
3+
# Vim runtime support library
4+
#
5+
# Maintainer: The Vim Project <https://github.com/vim/vim>
6+
# Last Change: 2023 Oct 25
7+
8+
export def IsSafeExecutable(filetype: string, executable: string): bool
9+
var cwd = getcwd()
10+
return get(g:, filetype .. '_exec', get(g:, 'plugin_exec', 0))
11+
&& (fnamemodify(exepath(executable), ':p:h') !=# cwd
12+
|| (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1
13+
&& cwd != '.'))
14+
enddef
15+
16+
# Uncomment this line to check for compilation errors early
17+
# defcompile

0 commit comments

Comments
 (0)