33" Maintainer: This runtime file is looking for a new maintainer.
44" Original Author: Charles E. Campbell
55" Date: Jan 21, 2014
6- " Version: 36
6+ " Version: 37
77" Installing: :help glvs-install
88" Usage: :help glvs
99" Last Change: {{{1
10- " 2024 Sep 08 by Vim Project: several small fixes
10+ " 2024 Sep 08 by Vim Project: several small fixes (#15640)
11+ " 2024 Sep 23 by Vim Project: runtime dir selection fix (#15722)
12+ " autoloading search path fix
13+ " substitution of hardcoded commands with global variables
1114" }}}
1215"
1316" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
1922if exists (" g:loaded_getscript" )
2023 finish
2124endif
22- let g: loaded_getscript= " v36 "
25+ let g: loaded_getscript= " v37 "
2326if &cp
2427 echoerr " GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
2528 finish
@@ -87,6 +90,24 @@ if !exists("g:GetLatestVimScripts_downloadaddr")
8790 let g: GetLatestVimScripts_downloadaddr = ' https://www.vim.org/scripts/download_script.php?src_id='
8891endif
8992
93+ " define decompression tools (on windows this allows redirection to wsl or git tools).
94+ " Note tar is available as builtin since Windows 11.
95+ if ! exists (" g:GetLatestVimScripts_bunzip2" )
96+ let g: GetLatestVimScripts_bunzip2= " bunzip2"
97+ endif
98+
99+ if ! exists (" g:GetLatestVimScripts_gunzip" )
100+ let g: GetLatestVimScripts_gunzip= " gunzip"
101+ endif
102+
103+ if ! exists (" g:GetLatestVimScripts_unxz" )
104+ let g: GetLatestVimScripts_unxz= " unxz"
105+ endif
106+
107+ if ! exists (" g:GetLatestVimScripts_unzip" )
108+ let g: GetLatestVimScripts_unzip= " unzip"
109+ endif
110+
90111" " For debugging:
91112" let g:GetLatestVimScripts_wget = "echo"
92113" let g:GetLatestVimScripts_options = "options"
@@ -96,18 +117,16 @@ endif
96117let s: autoinstall= " "
97118if g: GetLatestVimScripts_allowautoinstall
98119
99- if (has (" win32" ) || has (" gui_win32" ) || has (" gui_win32s" ) || has (" win16" ) || has (" win64" ) || has (" win32unix" ) || has (" win95" )) && &shell !~ ' \cbash\|pwsh\|powershell'
100- " windows (but not cygwin/bash)
101- let s: dotvim= " vimfiles"
102- if ! exists (" g:GetLatestVimScripts_mv" )
103- let g: GetLatestVimScripts_mv= " move"
104- endif
120+ let s: is_windows = has (" win32" ) || has (" gui_win32" ) || has (" gui_win32s" ) || has (" win16" ) || has (" win64" ) || has (" win32unix" ) || has (" win95" )
121+ let s: dotvim= s: is_windows ? " vimfiles" : " .vim"
105122
106- else
107- " unix
108- let s: dotvim= " .vim"
109- if ! exists (" g:GetLatestVimScripts_mv" )
110- let g: GetLatestVimScripts_mv= " mv"
123+ if ! exists (" g:GetLatestVimScripts_mv" )
124+ if s: is_windows && &shell !~ ' \cbash\|pwsh\|powershell'
125+ " windows (but not cygwin/bash)
126+ let g: GetLatestVimScripts_mv= " move"
127+ else
128+ " unix
129+ let g: GetLatestVimScripts_mv= " mv"
111130 endif
112131 endif
113132
@@ -215,10 +234,15 @@ fun! getscript#GetLatestVimScripts()
215234" call Decho("searching plugins for GetLatestVimScripts dependencies")
216235 let lastline = line (" $" )
217236" call Decho("lastline#".lastline)
218- let firstdir = substitute (&rtp ,' ,.{-} $' ,' ' ,' ' )
237+ let firstdir = substitute (&rtp ,' ,.* $' ,' ' ,' ' )
219238 let plugins = split (globpath (firstdir," plugin/**/*.vim" ),' \n' )
220239 let plugins += split (globpath (firstdir," ftplugin/**/*.vim" ),' \n' )
221240 let plugins += split (globpath (firstdir," AsNeeded/**/*.vim" ),' \n' )
241+ " extend the search to the packages too (this script predates the feature)
242+ let plugins += split (globpath (firstdir," pack/*/start/*/plugin/**/*.vim" ),' \n' )
243+ let plugins += split (globpath (firstdir," pack/*/opt/*/plugin/**/*.vim" ),' \n' )
244+ let plugins += split (globpath (firstdir," pack/*/start/*/ftplugin/**/*.vim" ),' \n' )
245+ let plugins += split (globpath (firstdir," pack/*/opt/*/ftplugin/**/*.vim" ),' \n' )
222246 let foundscript = 0
223247
224248 " this loop updates the GetLatestVimScripts.dat file
@@ -341,7 +365,7 @@ fun! getscript#GetLatestVimScripts()
341365endfun
342366
343367" ---------------------------------------------------------------------
344- " GetOneScript: (Get Latest Vim Script ) this function operates {{{1
368+ " GetOneScript: (Get Latest Vim script ) this function operates {{{1
345369" on the current line, interpreting two numbers and text as
346370" ScriptID, SourceID, and Filename.
347371" It downloads any scripts that have newer versions from vim.sourceforge.net.
@@ -564,17 +588,17 @@ fun! s:GetOneScript(...)
564588 " decompress
565589 if sname = ~ ' \.bz2$'
566590" call Decho("decompress: attempt to bunzip2 ".sname)
567- exe " sil !bunzip2 " .shellescape (sname)
591+ exe " sil !" . g: GetLatestVimScripts_bunzip2 . " " .shellescape (sname)
568592 let sname= substitute (sname,' \.bz2$' ,' ' ,' ' )
569593" call Decho("decompress: new sname<".sname."> after bunzip2")
570594 elseif sname = ~ ' \.gz$'
571595" call Decho("decompress: attempt to gunzip ".sname)
572- exe " sil !gunzip " .shellescape (sname)
596+ exe " sil !" . g: GetLatestVimScripts_gunzip . " " .shellescape (sname)
573597 let sname= substitute (sname,' \.gz$' ,' ' ,' ' )
574598" call Decho("decompress: new sname<".sname."> after gunzip")
575599 elseif sname = ~ ' \.xz$'
576600" call Decho("decompress: attempt to unxz ".sname)
577- exe " sil !unxz " .shellescape (sname)
601+ exe " sil !" . g: GetLatestVimScripts_unxz . " " .shellescape (sname)
578602 let sname= substitute (sname,' \.xz$' ,' ' ,' ' )
579603" call Decho("decompress: new sname<".sname."> after unxz")
580604 else
@@ -584,7 +608,7 @@ fun! s:GetOneScript(...)
584608 " distribute archive(.zip, .tar, .vba, .vmb, ...) contents
585609 if sname = ~ ' \.zip$'
586610" call Decho("dearchive: attempt to unzip ".sname)
587- exe " silent !unzip -o " .shellescape (sname)
611+ exe " silent !" . g: GetLatestVimScripts_unzip . " -o " .shellescape (sname)
588612 elseif sname = ~ ' \.tar$'
589613" call Decho("dearchive: attempt to untar ".sname)
590614 exe " silent !tar -xvf " .shellescape (sname)
0 commit comments