Skip to content

Commit 609599c

Browse files
MiguelBarrochrisbra
authored andcommitted
runtime(glvs): update GetLatestVimScripts plugin
GetLatestVimScripts builtin plugin required several fixes: * Support for the new vimbal `.vmb` extension introduced in [patch 9.0.1797](vim/vim@f97f6bb): Vimball/Visual Basic filetype detection conflict * Update the urls from the old `sourceforge.net` to `vim.org`. The download url was hardcoded and a new variable is introduced. * Fix `curl` command line option to set a filename (`-O` uses the remote filename and `-o` specifies a filename). * Replace windows' command to move files. `REN` can only rename files and the script actually moves them. My educated guess was that originally only renaming was necessary. When the script was modified to move files no change was required on linux because `mv` does both. * Fix Autoinstall support to check `ftplugins` and `pack-plugins` too (`pack-plugins` did not exist when the plugin was created). closes: #15640 Signed-off-by: GuyBrush <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 0b2285c commit 609599c

2 files changed

Lines changed: 40 additions & 24 deletions

File tree

runtime/autoload/getscript.vim

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
" Version: 36
77
" Installing: :help glvs-install
88
" Usage: :help glvs
9+
" Last Change: {{{1
10+
" 2024 Sep 08 by Vim Project: several small fixes
11+
" }}}
912
"
1013
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
1114
"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
@@ -64,7 +67,7 @@ if !exists("g:GetLatestVimScripts_options")
6467
if g:GetLatestVimScripts_wget == "wget"
6568
let g:GetLatestVimScripts_options= "-q -O"
6669
elseif g:GetLatestVimScripts_wget == "curl"
67-
let g:GetLatestVimScripts_options= "-s -O"
70+
let g:GetLatestVimScripts_options= "-s -o"
6871
else
6972
let g:GetLatestVimScripts_options= ""
7073
endif
@@ -77,7 +80,11 @@ endif
7780

7881
" set up default scriptaddr address
7982
if !exists("g:GetLatestVimScripts_scriptaddr")
80-
let g:GetLatestVimScripts_scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='
83+
let g:GetLatestVimScripts_scriptaddr = 'https://www.vim.org/scripts/script.php?script_id='
84+
endif
85+
86+
if !exists("g:GetLatestVimScripts_downloadaddr")
87+
let g:GetLatestVimScripts_downloadaddr = 'https://www.vim.org/scripts/download_script.php?src_id='
8188
endif
8289

8390
"" For debugging:
@@ -89,11 +96,11 @@ endif
8996
let s:autoinstall= ""
9097
if g:GetLatestVimScripts_allowautoinstall
9198

92-
if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash"
99+
if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell !~ '\cbash\|pwsh\|powershell'
93100
" windows (but not cygwin/bash)
94101
let s:dotvim= "vimfiles"
95102
if !exists("g:GetLatestVimScripts_mv")
96-
let g:GetLatestVimScripts_mv= "ren"
103+
let g:GetLatestVimScripts_mv= "move"
97104
endif
98105

99106
else
@@ -208,9 +215,10 @@ fun! getscript#GetLatestVimScripts()
208215
" call Decho("searching plugins for GetLatestVimScripts dependencies")
209216
let lastline = line("$")
210217
" call Decho("lastline#".lastline)
211-
let firstdir = substitute(&rtp,',.*$','','')
218+
let firstdir = substitute(&rtp,',.{-}$','','')
212219
let plugins = split(globpath(firstdir,"plugin/**/*.vim"),'\n')
213-
let plugins = plugins + split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n')
220+
let plugins += split(globpath(firstdir,"ftplugin/**/*.vim"),'\n')
221+
let plugins += split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n')
214222
let foundscript = 0
215223

216224
" this loop updates the GetLatestVimScripts.dat file
@@ -515,11 +523,11 @@ fun! s:GetOneScript(...)
515523
" call Decho(".downloading new <".sname.">")
516524
echomsg ".downloading new <".sname.">"
517525
if has("win32") || has("win16") || has("win95")
518-
" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)."|q")
519-
new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)|q
526+
" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr.latestsrcid)."|q")
527+
new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr.latestsrcid)|q
520528
else
521-
" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='))
522-
exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=').latestsrcid
529+
" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr).latestsrcid
530+
exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr).latestsrcid
523531
endif
524532

525533
" --------------------------------------------------------------------------
@@ -573,7 +581,7 @@ fun! s:GetOneScript(...)
573581
" call Decho("no decompression needed")
574582
endif
575583

576-
" distribute archive(.zip, .tar, .vba, ...) contents
584+
" distribute archive(.zip, .tar, .vba, .vmb, ...) contents
577585
if sname =~ '\.zip$'
578586
" call Decho("dearchive: attempt to unzip ".sname)
579587
exe "silent !unzip -o ".shellescape(sname)
@@ -592,7 +600,7 @@ fun! s:GetOneScript(...)
592600
elseif sname =~ '\.txz$'
593601
" call Decho("dearchive: attempt to untar+xz ".sname)
594602
exe "silent !tar -Jxvf ".shellescape(sname)
595-
elseif sname =~ '\.vba$'
603+
elseif sname =~ '\.vba$\|\.vmb$'
596604
" call Decho("dearchive: attempt to handle a vimball: ".sname)
597605
silent 1split
598606
if exists("g:vimball_home")

runtime/doc/pi_getscript.txt

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*pi_getscript.txt* For Vim version 9.1. Last change: 2017 Aug 01
1+
*pi_getscript.txt* For Vim version 9.1. Last change: 2024 Sep 08
22
>
33
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
44
<
@@ -20,7 +20,7 @@ Copyright: (c) 2004-2012 by Charles E. Campbell *glvs-copyright*
2020
Getscript is a plugin that simplifies retrieval of the latest versions of the
2121
scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
2222
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
23-
get the latest versions of scripts listed therein from http://vim.sf.net/.
23+
get the latest versions of scripts listed therein from https://www.vim.org/.
2424

2525
==============================================================================
2626
1. Contents *glvs-contents* *glvs* *getscript*
@@ -59,9 +59,9 @@ the "important" part of it is the first two lines.
5959

6060
Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
6161

62-
1. if compressed: gunzip getscript.vba.gz
62+
1. if compressed: gunzip getscript.vmb.gz
6363
2. Unix:
64-
vim getscript.vba
64+
vim getscript.vmb
6565
:so %
6666
:q
6767
cd ~/.vim/GetLatest
@@ -70,7 +70,7 @@ Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
7070
list of desired plugins -- see |GetLatestVimScripts_dat|)
7171

7272
3. Windows:
73-
vim getscript.vba
73+
vim getscript.vmb
7474
:so %
7575
:q
7676
cd **path-to-vimfiles**/GetLatest
@@ -281,11 +281,14 @@ With :AutoInstall: enabled, as it is by default, files which end with
281281

282282
---.tar.bz2 : decompressed & untarred in .vim/ directory
283283
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
284+
---.vmb.bz2 : decompressed in .vim/ directory, then vimball handles it
284285
---.vim.bz2 : decompressed & moved into .vim/plugin directory
285286
---.tar.gz : decompressed & untarred in .vim/ directory
286287
---.vba.gz : decompressed in .vim/ directory, then vimball handles it
288+
---.vmb.gz : decompressed in .vim/ directory, then vimball handles it
287289
---.vim.gz : decompressed & moved into .vim/plugin directory
288-
---.vba : unzipped in .vim/ directory
290+
---.vba : moved to .vim/ directory, then vimball handles it
291+
---.vmb : moved to .vim/ directory, then vimball handles it
289292
---.vim : moved to .vim/plugin directory
290293
---.zip : unzipped in .vim/ directory
291294

@@ -300,7 +303,7 @@ When is a script not auto-installable? Let me give an example:
300303
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
301304
available at:
302305

303-
http://vim.sourceforge.net/scripts/script.php?script_id=104
306+
https://www.vim.org/scripts/script.php?script_id=104
304307

305308
Currently, vim's after/syntax only supports by-filetype scripts (in
306309
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
@@ -309,7 +312,7 @@ possibly overwrite the current user's after/syntax/c.vim file.
309312
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
310313
allow a after/syntax/c/ directory:
311314

312-
http://vim.sourceforge.net/scripts/script.php?script_id=1023
315+
https://www.vim.org/scripts/script.php?script_id=1023
313316

314317
The script allows multiple syntax files to exist separately in the
315318
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
@@ -345,17 +348,22 @@ after/syntax/c.vim contained in it to overwrite a user's c.vim.
345348
Doesn't override vimball installation.
346349
>
347350
g:GetLatestVimScripts_scriptaddr
348-
< default='http://vim.sourceforge.net/script.php?script_id='
351+
< default='https://www.vim.org/scripts/script.php?script_id='
349352
Override this if your system needs
350-
... ='http://vim.sourceforge.net/script/script.php?script_id='
351-
353+
... ='http://vim.sourceforge.net/script.php?script_id='
354+
>
355+
g:GetLatestVimScripts_downloadaddr
356+
< default='https://www.vim.org/scripts/download_script.php?src_id='
357+
Override this if your system needs
358+
... ='http://vim.sourceforge.net/scripts/download_script.php?src_id='
359+
>
352360
==============================================================================
353361
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
354362

355363
The Vim sourceforge page dynamically creates a page by keying off of the
356364
so-called script-id. Within the webpage of
357365

358-
http://vim.sourceforge.net/scripts/script.php?script_id=40
366+
https://www.vim.org/scripts/script.php?script_id=40
359367

360368
is a line specifying the latest source-id (src_id). The source identifier
361369
numbers are always increasing, hence if the src_id is greater than the one

0 commit comments

Comments
 (0)