0
0
mirror of https://github.com/vim/vim.git synced 2025-07-25 10:54:51 -04:00

runtime(glvs): update GetLatestVimScripts plugin

GetLatestVimScripts builtin plugin required several fixes:
* Support for the new vimbal `.vmb` extension introduced in
  [patch 9.0.1797](f97f6bbf56):
  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 <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
GuyBrush 2024-09-08 19:54:43 +02:00 committed by Christian Brabandt
parent 0b2285c96b
commit 609599cc45
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 40 additions and 24 deletions

View File

@ -6,6 +6,9 @@
" Version: 36 " Version: 36
" Installing: :help glvs-install " Installing: :help glvs-install
" Usage: :help glvs " Usage: :help glvs
" Last Change: {{{1
" 2024 Sep 08 by Vim Project: several small fixes
" }}}
" "
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim " GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore() "redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
@ -64,7 +67,7 @@ if !exists("g:GetLatestVimScripts_options")
if g:GetLatestVimScripts_wget == "wget" if g:GetLatestVimScripts_wget == "wget"
let g:GetLatestVimScripts_options= "-q -O" let g:GetLatestVimScripts_options= "-q -O"
elseif g:GetLatestVimScripts_wget == "curl" elseif g:GetLatestVimScripts_wget == "curl"
let g:GetLatestVimScripts_options= "-s -O" let g:GetLatestVimScripts_options= "-s -o"
else else
let g:GetLatestVimScripts_options= "" let g:GetLatestVimScripts_options= ""
endif endif
@ -77,7 +80,11 @@ endif
" set up default scriptaddr address " set up default scriptaddr address
if !exists("g:GetLatestVimScripts_scriptaddr") if !exists("g:GetLatestVimScripts_scriptaddr")
let g:GetLatestVimScripts_scriptaddr = 'http://vim.sourceforge.net/script.php?script_id=' let g:GetLatestVimScripts_scriptaddr = 'https://www.vim.org/scripts/script.php?script_id='
endif
if !exists("g:GetLatestVimScripts_downloadaddr")
let g:GetLatestVimScripts_downloadaddr = 'https://www.vim.org/scripts/download_script.php?src_id='
endif endif
"" For debugging: "" For debugging:
@ -89,11 +96,11 @@ endif
let s:autoinstall= "" let s:autoinstall= ""
if g:GetLatestVimScripts_allowautoinstall if g:GetLatestVimScripts_allowautoinstall
if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash" if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell !~ '\cbash\|pwsh\|powershell'
" windows (but not cygwin/bash) " windows (but not cygwin/bash)
let s:dotvim= "vimfiles" let s:dotvim= "vimfiles"
if !exists("g:GetLatestVimScripts_mv") if !exists("g:GetLatestVimScripts_mv")
let g:GetLatestVimScripts_mv= "ren" let g:GetLatestVimScripts_mv= "move"
endif endif
else else
@ -208,9 +215,10 @@ fun! getscript#GetLatestVimScripts()
" call Decho("searching plugins for GetLatestVimScripts dependencies") " call Decho("searching plugins for GetLatestVimScripts dependencies")
let lastline = line("$") let lastline = line("$")
" call Decho("lastline#".lastline) " call Decho("lastline#".lastline)
let firstdir = substitute(&rtp,',.*$','','') let firstdir = substitute(&rtp,',.{-}$','','')
let plugins = split(globpath(firstdir,"plugin/**/*.vim"),'\n') let plugins = split(globpath(firstdir,"plugin/**/*.vim"),'\n')
let plugins = plugins + split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n') let plugins += split(globpath(firstdir,"ftplugin/**/*.vim"),'\n')
let plugins += split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n')
let foundscript = 0 let foundscript = 0
" this loop updates the GetLatestVimScripts.dat file " this loop updates the GetLatestVimScripts.dat file
@ -515,11 +523,11 @@ fun! s:GetOneScript(...)
" call Decho(".downloading new <".sname.">") " call Decho(".downloading new <".sname.">")
echomsg ".downloading new <".sname.">" echomsg ".downloading new <".sname.">"
if has("win32") || has("win16") || has("win95") if has("win32") || has("win16") || has("win95")
" 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") " call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr.latestsrcid)."|q")
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 new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr.latestsrcid)|q
else else
" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=')) " call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr).latestsrcid
exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=').latestsrcid exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape(g:GetLatestVimScripts_downloadaddr).latestsrcid
endif endif
" -------------------------------------------------------------------------- " --------------------------------------------------------------------------
@ -573,7 +581,7 @@ fun! s:GetOneScript(...)
" call Decho("no decompression needed") " call Decho("no decompression needed")
endif endif
" distribute archive(.zip, .tar, .vba, ...) contents " distribute archive(.zip, .tar, .vba, .vmb, ...) contents
if sname =~ '\.zip$' if sname =~ '\.zip$'
" call Decho("dearchive: attempt to unzip ".sname) " call Decho("dearchive: attempt to unzip ".sname)
exe "silent !unzip -o ".shellescape(sname) exe "silent !unzip -o ".shellescape(sname)
@ -592,7 +600,7 @@ fun! s:GetOneScript(...)
elseif sname =~ '\.txz$' elseif sname =~ '\.txz$'
" call Decho("dearchive: attempt to untar+xz ".sname) " call Decho("dearchive: attempt to untar+xz ".sname)
exe "silent !tar -Jxvf ".shellescape(sname) exe "silent !tar -Jxvf ".shellescape(sname)
elseif sname =~ '\.vba$' elseif sname =~ '\.vba$\|\.vmb$'
" call Decho("dearchive: attempt to handle a vimball: ".sname) " call Decho("dearchive: attempt to handle a vimball: ".sname)
silent 1split silent 1split
if exists("g:vimball_home") if exists("g:vimball_home")

View File

@ -1,4 +1,4 @@
*pi_getscript.txt* For Vim version 9.1. Last change: 2017 Aug 01 *pi_getscript.txt* For Vim version 9.1. Last change: 2024 Sep 08
> >
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
< <
@ -20,7 +20,7 @@ Copyright: (c) 2004-2012 by Charles E. Campbell *glvs-copyright*
Getscript is a plugin that simplifies retrieval of the latest versions of the Getscript is a plugin that simplifies retrieval of the latest versions of the
scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
get the latest versions of scripts listed therein from http://vim.sf.net/. get the latest versions of scripts listed therein from https://www.vim.org/.
============================================================================== ==============================================================================
1. Contents *glvs-contents* *glvs* *getscript* 1. Contents *glvs-contents* *glvs* *getscript*
@ -59,9 +59,9 @@ the "important" part of it is the first two lines.
Your computer needs to have wget or curl for GetLatestVimScripts to do its work. Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
1. if compressed: gunzip getscript.vba.gz 1. if compressed: gunzip getscript.vmb.gz
2. Unix: 2. Unix:
vim getscript.vba vim getscript.vmb
:so % :so %
:q :q
cd ~/.vim/GetLatest cd ~/.vim/GetLatest
@ -70,7 +70,7 @@ Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
list of desired plugins -- see |GetLatestVimScripts_dat|) list of desired plugins -- see |GetLatestVimScripts_dat|)
3. Windows: 3. Windows:
vim getscript.vba vim getscript.vmb
:so % :so %
:q :q
cd **path-to-vimfiles**/GetLatest cd **path-to-vimfiles**/GetLatest
@ -281,11 +281,14 @@ With :AutoInstall: enabled, as it is by default, files which end with
---.tar.bz2 : decompressed & untarred in .vim/ directory ---.tar.bz2 : decompressed & untarred in .vim/ directory
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it ---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
---.vmb.bz2 : decompressed in .vim/ directory, then vimball handles it
---.vim.bz2 : decompressed & moved into .vim/plugin directory ---.vim.bz2 : decompressed & moved into .vim/plugin directory
---.tar.gz : decompressed & untarred in .vim/ directory ---.tar.gz : decompressed & untarred in .vim/ directory
---.vba.gz : decompressed in .vim/ directory, then vimball handles it ---.vba.gz : decompressed in .vim/ directory, then vimball handles it
---.vmb.gz : decompressed in .vim/ directory, then vimball handles it
---.vim.gz : decompressed & moved into .vim/plugin directory ---.vim.gz : decompressed & moved into .vim/plugin directory
---.vba : unzipped in .vim/ directory ---.vba : moved to .vim/ directory, then vimball handles it
---.vmb : moved to .vim/ directory, then vimball handles it
---.vim : moved to .vim/plugin directory ---.vim : moved to .vim/plugin directory
---.zip : unzipped in .vim/ directory ---.zip : unzipped in .vim/ directory
@ -300,7 +303,7 @@ When is a script not auto-installable? Let me give an example:
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
available at: available at:
http://vim.sourceforge.net/scripts/script.php?script_id=104 https://www.vim.org/scripts/script.php?script_id=104
Currently, vim's after/syntax only supports by-filetype scripts (in Currently, vim's after/syntax only supports by-filetype scripts (in
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would 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.
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
allow a after/syntax/c/ directory: allow a after/syntax/c/ directory:
http://vim.sourceforge.net/scripts/script.php?script_id=1023 https://www.vim.org/scripts/script.php?script_id=1023
The script allows multiple syntax files to exist separately in the The script allows multiple syntax files to exist separately in the
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an 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.
Doesn't override vimball installation. Doesn't override vimball installation.
> >
g:GetLatestVimScripts_scriptaddr g:GetLatestVimScripts_scriptaddr
< default='http://vim.sourceforge.net/script.php?script_id=' < default='https://www.vim.org/scripts/script.php?script_id='
Override this if your system needs Override this if your system needs
... ='http://vim.sourceforge.net/script/script.php?script_id=' ... ='http://vim.sourceforge.net/script.php?script_id='
>
g:GetLatestVimScripts_downloadaddr
< default='https://www.vim.org/scripts/download_script.php?src_id='
Override this if your system needs
... ='http://vim.sourceforge.net/scripts/download_script.php?src_id='
>
============================================================================== ==============================================================================
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg* 8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
The Vim sourceforge page dynamically creates a page by keying off of the The Vim sourceforge page dynamically creates a page by keying off of the
so-called script-id. Within the webpage of so-called script-id. Within the webpage of
http://vim.sourceforge.net/scripts/script.php?script_id=40 https://www.vim.org/scripts/script.php?script_id=40
is a line specifying the latest source-id (src_id). The source identifier is a line specifying the latest source-id (src_id). The source identifier
numbers are always increasing, hence if the src_id is greater than the one numbers are always increasing, hence if the src_id is greater than the one