pi_getscript.txt For ViAI バージョン 1.0. Last change: 2026 Aug 17
Original Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
(メールアドレスから NOSPAM を削除すること)
GetLatestVimScripts-copyright
Copyright: (c) 2004-2012 by Charles E. Campbell glvs-copyright
The VIM LICENSE (see copyright) applies to the files in this
package, including getscriptPlugin.vim, getscript.vim,
GetLatestVimScripts.dist, and pi_getscript.txt, except use "getscript"
instead of "Vim". Like anything else that's free, getscript and its
associated files are provided *as is* and comes with no warranty of
any kind, either expressed or implied. No guarantees of
merchantability. No guarantees of suitability for any purpose. By
using this plugin, you agree that in no event will the copyright
holder be liable for any damages resulting from the use of this
software. Use at your own risk!
Getscript は、あなた自身が使っているスクリプトの最新版の取得を簡単にするプラグ
インである! :GLVS とタイプすると getscript が起動し、続いて
<GetLatestVimScripts.dat> (GetLatestVimScripts_dat を参照) ファイルを使って、
そこに列挙されているスクリプトの最新版を https://www.vim.org/ から取得する。
==============================================================================
1. 目次 glvs-contents glvs getscript
GetLatestVimScripts
1. 目次............................................: glvs-contents
2. GetLatestVimScripts -- はじめに.................: glvs-install
3. GetLatestVimScripts の使い方....................: glvs-usage
4. GetLatestVimScripts データファイル..............: glvs-data
5. GetLatestVimScripts 対応プラグイン..............: glvs-plugins
6. GetLatestVimScripts AutoInstall.................: glvs-autoinstall
7. GetLatestViMScripts オプション..................: glvs-options
8. GetLatestVimScripts アルゴリズム................: glvs-alg
9. GetLatestVimScripts 履歴........................: glvs-hist
==============================================================================
2. GetLatestVimScripts -- はじめに getscript-start
getlatestvimscripts-install
Vim の配布物からの版 glvs-dist-install
Vim 7.0 には、例およびテンプレートとなる GetLatestVimScripts.dist ファイルは含
まれていない。そのため、自分で作成する必要がある! GetLatestVimScripts_dat
を参照。
VIM SF NET からの版 glvs-install
NOTE: 最後の手順、つまり GetLatestVimScripts.dist ファイルの名前の変更/移動は、
GetLatestVimScripts.tar.bz2 を初めてダウンロードした人のためのものである。
GetLatestVimScripts.dist ファイルは、あなた自身の個人用リストの例およびテンプ
レートとなる。その中に書かれているスクリプトはすべて自由に削除してよい。その
"重要な" 部分は最初の 2 行である。
GetLatestVimScripts が動作するには、コンピュータに wget か curl が必要である。
1. 圧縮されている場合: gunzip getscript.vmb.gz
2. Unix:
vim getscript.vmb
:so %
:q
cd ~/.vim/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(GetLatestVimScripts.dat を編集して、欲しいプラグインの個人用
リストをインストールする -- GetLatestVimScripts_dat を参照)
3. Windows:
vim getscript.vmb
:so %
:q
cd **path-to-vimfiles**/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(GetLatestVimScripts.dat を編集して、欲しいプラグインの個人用
リストをインストールする -- GetLatestVimScripts_dat を参照)
読み込みの防止
プラグインは使いたいが、何らかの理由で getscript は使いたくない場合は、以下を
vimrc に追加することで getscript プラグインの読み込みを避けられる:
==============================================================================
3. GetLatestVimScripts の使い方 glvs-usage :GLVS
他の場所で定義されていなければ
で GetLatestVimScripts() が起動する。他のプラグインがそのコマンドを定義してい
た場合は、次のようにタイプすればよい
このスクリプトは更新を試み、許可されていれば http://vim.sourceforge.net/ から
スクリプトを自動的にインストールする。そのために、ファイル
または
のプラグインを調べる (glvs-plugins を参照)。
ダウンロードされたスクリプトは
~/.vim/GetLatest (unix) または ..wherever..\vimfiles\GetLatest (windows)
サブディレクトリに現れる。<.vimrc> に以下の行がある場合、GetLatestVimScripts
はそれらを自動的にインストールしようとする:
GetLatestVimScripts.dat> ファイルは、そのようにダウンロードされたスクリプトの
最新版を反映するように自動的に更新される。
(glvs-options も参照)
==============================================================================
4. GetLatestVimScripts データファイル getscript-data glvs-data
:GetLatestVimScripts_dat
データファイル <GetLatestVimScripts.dat> は、最初の 2 行に以下のテキストがなけ
ればならない:
その 2 行に続くのは 3 つの列である。最初の 2 つは数値で、その後にテキストの列
が続く。GetLatest/GetLatestVimScripts.dist ファイルには、そのようなデータファ
イルの例が含まれている。#... に続くものはすべて無視されるので、ファイルにコメ
ントを埋め込んでよい。
各行の最初の数値はスクリプトの ScriptID を与える。ウェブブラウザーを使って
http://vim.sf.net/ のスクリプトを見ようとするとき、スクリプトのリンクをクリッ
クする直前に、次のような行が見えるだろう
http://vim.sourceforge.net/scripts/script.php?script_id=40
この "40" がたまたま、GetLatestVimScripts が関連するページをダウンロードするの
に必要な ScriptID であり、プラグインの最初のアップロードの間に vim.sf.net 自身
によって割り当てられる。
各行の 2 番目の数値はスクリプトの SourceID を与える。SourceID は、vim.sf.net
が決めたアップロード済みスクリプトの数を記録している。そのため、スクリプトが
"いつ" アップロードされたかを示す役目を果たす。SourceID を 1 に設定すると、
GetLatestVimScripts は手元にあるスクリプトが古いとみなすことが保証される。
SourceID は、GetLatestVimScripts によって vim.sf.net のスクリプトのページから
取り出される。それが GetLatestVimScripts.dat ファイルに保存されているものより
大きいときは常に、スクリプトがダウンロードされる
(GetLatestVimScripts_dat を参照)。
スクリプトの作者が自分のプラグインに特別なコメント行を含めている場合は、そのプ
ラグイン自身が GetLatestVimScripts によって、それが持つかもしれない他のスクリ
プトへの依存関係も含めて、あなたの <GetLatestVimScripts.dat> ファイルを作成す
るのに使われる。例として、次を考える:
このコメント行は getscript.vim に、Vim script #884 をチェックすること、そして
そのスクリプトが自動的にインストール可能であることを伝える。Getscript はまた、
この行を使い、次のような行を含めることで GetLatestVimScripts.dat ファイルの作
成を助ける:
ただし、そのような行がまだ GetLatestVimScripts.dat ファイルにないと仮定しての
ことである。詳細は glvs-plugins を参照。このように、GetLatestVimScripts はこ
のように、あなたのプラグインを最新に保つ包括的な機能を提供する!
要約すると:
* 任意で、既にインストールされているプラグインに基づいて
GetLatestVimScripts.dat ファイルを作成/追記してよいことを getscript に伝え
る:
* 次のような行は
いうプラグイン作者の同意を構成する。すべてのプラグインが AutoInstall 可能
とは限らず、自分のプラグインが正しく AutoInstall されるかどうかを知るのに
最も適した立場にいるのはプラグインの作者である。
* 次のような行は
のあなたの許可を構成する。AutoInstall にはあなたとプラグイン作者の両方の許
可が必要である。GetLatestVimScripts_dat を参照。
GetLatestVimScripts_dat
<GetLatestVimScripts.dat> ファイルの例として:
Note: 最初の 2 行は必須だが、本質的にはコメントとして働く。
==============================================================================
5. GetLatestVimScripts 対応プラグイン getscript-plugins glvs-plugins
(この節はプラグイン作者向け)
プラグインの作者が自分のプラグイン内のどこかに以下のコメントを含めると、
GetLatestVimScripts はそれを見つけ、それを使ってユーザーの
GetLatestVimScripts.dat ファイルを自動的に作成する:
作者として、あなたは自分自身のスクリプトを参照するそのような行と、それが持つか
もしれないプラグインの依存関係を記述する追加の行を含めるべきである。もちろん同
じ形式で!
あなたのコマンドが自動インストール可能な場合 (glvs-autoinstall を参照)、ほと
んどのスクリプトはそうなのだが、"yourscriptname" の直前に :AutoInstall: を含め
てよい:
NOTE: :AutoInstall: 機能が動作するには、プラグイン作者と
ユーザーの両方の許可が必要である!
そして、それらのスクリプトの GetLatestVimScripts コマンドが、まだ存在しなけれ
ば、ユーザーの GetLatest/GetLatestVimScripts.dat ファイルに追加される。これは、
あなたのプラグインが依存するスクリプトの取得を自動化する、比較的手間のかからな
い方法である。
さて、作者としては、GetLatestVimScripts が自分のスクリプトを自分の手元のコピー
の上にダウンロードし、それによってまだリリースしていない苦労の成果を上書きして
しまうことは望まないだろう。GetLatestVimScripts はこれに対する解決策を提供して
いる: 次の行
を <GetLatestVimScripts.dat> ファイルに入れると、GetLatestVimScripts は
"yourscriptname" スクリプトについて、それらの GetLatestVimScripts コメント行の
調査を飛ばす。その結果、それらの行がうっかり <GetLatestVimScripts.dat> ファイ
ルに入れられ、その後で自分のスクリプトのダウンロードに使われることはな
い。:AutoInstall: オプションを含めている場合は、これを行うことが特に重要であ
る。
必ず "0 0 yourscriptname" の行で、GetLatestVimScripts コメントで使ったのと同じ
"yourscriptname" を使うこと!
==============================================================================
6. GetLatestVimScripts AutoInstall getscript-autoinstall
glvs-autoinstall
GetLatestVimScripts は現在 "AutoInstall" をサポートしている。すべてのスクリプ
トが自動インストールに対応しているわけではない。インストールするために特別なこ
とをする必要がある場合があるからである (スクリプトの "install" の指示を参照)。
一方で、ほとんどのスクリプトは自動インストール可能である。
GetLatestVimScripts に自動インストールをさせるには、データファイルのコメント
フィールドが次で始まっていなければならない (前後の空白は無視される):
両方のコロンが必要であり、それがコメント (yourscriptname) フィールドの先頭にな
ければならない。
<.vimrc> に以下の行を入れると、自動インストールをすべて防ぐことができる:
デフォルトのとおり :AutoInstall: が有効な場合、次で終わり
---.tar.bz2 : .vim/ ディレクトリで解凍し untar する
---.vba.bz2 : .vim/ ディレクトリで解凍し、その後 vimball が処理する
---.vmb.bz2 : 同上
---.vim.bz2 : 解凍し .vim/plugin ディレクトリに移動する
---.tar.gz : .vim/ ディレクトリで解凍し untar する
---.vba.gz : .vim/ ディレクトリで解凍し、その後 vimball が処理する
---.vmb.gz : 同上
---.vim.gz : 解凍し .vim/plugin ディレクトリに移動する
---.vba : .vim/ ディレクトリに移動し、その後 vimball が処理する
---.vmb : 同上
---.vim : .vim/plugin ディレクトリに移動する
---.zip : .vim/ ディレクトリで unzip する
かつ untar/gunzip またはプラグインディレクトリへの移動の処理によって構成要素を
配置するだけでよいファイルは、自動インストール可能なはずである。もちろん、
Vimball は常に自動インストール可能なはずである。
スクリプトが自動インストール可能でないのはどんなときか? 例を挙げよう:
.vim/after/syntax/blockhl.vim
<blockhl.vim> スクリプトは C/C++ プログラムのブロックハイライトを提供する。次
から入手できる:
https://www.vim.org/scripts/script.php?script_id=104
現在、vim の after/syntax はファイルタイプ別のスクリプトしかサポートしていない
(blockhl.vim の場合、それは after/syntax/c.vim である)。そのため、自動インス
トールは現在のユーザーの after/syntax/c.vim ファイルを上書きしてしまう可能性が
ある。
私自身の場合は、after/syntax/c/ ディレクトリを使えるようにするために
<aftersyntax.vim> (after/syntax/c.vim に名前を変えたもの) を使っている:
https://www.vim.org/scripts/script.php?script_id=1023
このスクリプトにより、after/syntax/c サブディレクトリに複数の構文ファイルを別々
に置くことができる。その中に含まれる after/syntax/c.vim がユーザーの c.vim を
上書きする可能性があるため、aftersyntax.vim を同梱して自動インストール用の適切
な tarball を作ることはできない。
==============================================================================
7. GetLatestVimScripts オプション glvs-options
この変数は、スクリプトを取得するためのコマンドの名前を保持す
る。
この変数は、g:GetLatestVimScripts_wget コマンドで使われるオプ
ションを保持する。
この変数は、GetLatestVimScripts がスクリプトの自動インストール
を試みることが許されているかどうかを示す。さらに、プラグインの
作者が、自分のプラグインが自動インストール可能であることを
(GetLatestVimScripts コメント行の :AutoInstall: キーワードに
よって) 明示的に示していなければならない。
デフォルト= $HOME/vimfiles (windows)
:AutoInstall: のスクリプトがインストールされる場所を上書きす
る。vimball のインストールは上書きしない。
この変数は、.bz2 ファイルを解凍するコマンドの名前を保持する
この変数は、.bz3 ファイルを解凍するコマンドの名前を保持する
この変数は、.gz ファイルを解凍するコマンドの名前を保持する
この変数は、.xz ファイルを解凍するコマンドの名前を保持する
この変数は、.zip ファイルを解凍するコマンドの名前を保持する
Note: 解凍コマンドに関連する変数は、クロスプラットフォームの問題の回避に役立
つ。例えば、Windows では次のようにして、この呼び出しを wsl に委ねるこ
とが可能である:
==============================================================================
8. GetLatestVimScripts アルゴリズム glvs-algorithm glvs-alg
Vim の sourceforge のページは、いわゆる script-id をキーにしてページを動的に作
成する。
https://www.vim.org/scripts/script.php?script_id=40
のウェブページ内には、最新の source-id (src_id) を指定する行がある。ソース識別
番号は常に増加していくので、src_id が GetLatestVimScripts にそのスクリプト用に
記録されているものより大きければ、そのスクリプトの新しいコピーをダウンロードす
る時である。
そして GetLatestVimScripts はスクリプトをダウンロードし、スクリプト ID、ソース
ID、スクリプト名の内部データベースを更新する。
AutoInstall の処理は次のことを行う:
ファイルを GetLatest/ から以下のディレクトリに移動する
Unix : $HOME/.vim
Windows: $HOME\vimfiles
ダウンロードしたファイルが ".bz2" で終わる場合
それを bunzip2 する
そうでなく、ダウンロードしたファイルが ".bz3" で終わる場合
それを bunzip3 する
そうでなく、ダウンロードしたファイルが ".gz" で終わる場合
それを gunzip する
結果のファイルが ".zip" で終わる場合
それを unzip する
そうでなく、結果のファイルが ".tar" で終わる場合
それを tar -oxvf する
そうでなく、結果のファイルが ".vim" で終わる場合
それを plugin サブディレクトリに移動する
==============================================================================
9. GetLatestVimScripts 履歴 getscript-history glvs-hist {{{1
v38 Feb 25, 2025 : * handles additional decompression option for .bzip3 files.
v37 Sep 23, 2024 : * Support for the new vimball's .vmb extension (old .vba
extension conflicted with visual basic).
* Support for glvs-autoinstall in ftplugins and packages.
* Allow platform driven customization of decompressing
commands.
v36 Apr 22, 2013 : * (glts) suggested use of plugin/**/*.vim instead of
plugin/*.vim in globpath() call.
* (Andy Wokula) got warning message when setting
g:loaded_getscriptPlugin
v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script URL has
changed (somewhat). However, it doesn't work, and
the original one does (under Linux). I'll make it
yet-another-option.
v34 Jun 23, 2011 : * handles additional decompression options for tarballs
(tgz taz tbz txz)
v33 May 31, 2011 : * using fnameescape() instead of escape()
* *.xz support
v32 Jun 19, 2010 : * (Jan Steffens) added support for xz compression
v31 Jun 29, 2008 : * (Bill McCarthy) fixed having hls enabled with getscript
* (David Schaefer) the acd option interferes with vimballs
Solution: bypass the acd option
v30 Jun 13, 2008 : * GLVS now checks for existence of fnameescape() and will
issue an error message if it is not supported
v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
getscriptPlugin.vim was setting it but not restoring it.
v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
interface, register-a bypass
Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
creating pop-up windows
v24 Apr 16, 2007 : * removed save&restore of the fo option during script
loading
v23 Nov 03, 2006 : * ignores comments (#...)
* handles vimballs
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
available
v21 May 01, 2006 : * now takes advantage of autoloading.
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
unzip needs the -o flag to overwrite.
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
script! Fixed.
v18 Mar 21, 2005 : * bugfix to automatic database construction
* bugfix - nowrapscan caused an error
(tnx to David Green for the fix)
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
:AutoInstall:s, even though its o/s is windows
Apr 01, 2005 * when downloading errors occurred, GLVS was
terminating early. It now just goes on to trying
the next script (after trying three times to
download a script description page)
Apr 20, 2005 * bugfix - when a failure to download occurred,
GetLatestVimScripts would stop early and claim that
everything was current. Fixed.
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
defaults to 1, can be used to prevent all
:AutoInstall:
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
* fixed bug with :AutoInstall: use of helptags
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
always preventing downloads (just usually). Fixed.
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
s:dotvim. Fixed.
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
is zero. Useful for script authors; that way their
own GetLatestVimScripts activity won't overwrite
their scripts.
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
was intended only for testing. Removed, now works.
* :AutoInstall: implemented
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
* :GetLatestVimScripts command
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
now holds scripts that need updating
v10 Apr 19, 2004 : * moved history from script to doc
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
double quotes ("") whereas other systems will use
single quotes ('') around the urls in calls via wget
v8 Dec 01, 2003 : makes three tries at downloading
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
not found in downloaded webpage
Uses t_ti, t_te, and rs to make progress visible
v6 Aug 06, 2003 : final status messages now display summary of work
( "Downloaded someqty scripts" or
"Everything was current")
Now GetLatestVimScripts is careful about downloading
GetLatestVimScripts.vim itself!
(goes to <NEW_GetLatestVimScripts.vim>)
v5 Aug 04, 2003 : missing an endif near bottom
v4 Jun 17, 2003 : redraw! just before each "considering" message
v3 May 27, 2003 : Protects downloaded files from errant shell
expansions with single quotes: '...'
v2 May 14, 2003 : extracts name of item to be obtained from the
script file. Uses it instead of comment field
for output filename; comment is used in the
"considering..." line and is now just a comment!
* Fixed a bug: a string-of-numbers is not the
same as a number, so I added zero to them
and they became numbers. Fixes comparison.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:fdm=marker
GETSCRIPT リファレンスマニュアル
Original Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
(メールアドレスから NOSPAM を削除すること)
GetLatestVimScripts-copyright
Copyright: (c) 2004-2012 by Charles E. Campbell glvs-copyright
The VIM LICENSE (see copyright) applies to the files in this
package, including getscriptPlugin.vim, getscript.vim,
GetLatestVimScripts.dist, and pi_getscript.txt, except use "getscript"
instead of "Vim". Like anything else that's free, getscript and its
associated files are provided *as is* and comes with no warranty of
any kind, either expressed or implied. No guarantees of
merchantability. No guarantees of suitability for any purpose. By
using this plugin, you agree that in no event will the copyright
holder be liable for any damages resulting from the use of this
software. Use at your own risk!
Getscript は、あなた自身が使っているスクリプトの最新版の取得を簡単にするプラグ
インである! :GLVS とタイプすると getscript が起動し、続いて
<GetLatestVimScripts.dat> (GetLatestVimScripts_dat を参照) ファイルを使って、
そこに列挙されているスクリプトの最新版を https://www.vim.org/ から取得する。
==============================================================================
1. 目次 glvs-contents glvs getscript
GetLatestVimScripts
1. 目次............................................: glvs-contents
2. GetLatestVimScripts -- はじめに.................: glvs-install
3. GetLatestVimScripts の使い方....................: glvs-usage
4. GetLatestVimScripts データファイル..............: glvs-data
5. GetLatestVimScripts 対応プラグイン..............: glvs-plugins
6. GetLatestVimScripts AutoInstall.................: glvs-autoinstall
7. GetLatestViMScripts オプション..................: glvs-options
8. GetLatestVimScripts アルゴリズム................: glvs-alg
9. GetLatestVimScripts 履歴........................: glvs-hist
==============================================================================
2. GetLatestVimScripts -- はじめに getscript-start
getlatestvimscripts-install
Vim の配布物からの版 glvs-dist-install
Vim 7.0 には、例およびテンプレートとなる GetLatestVimScripts.dist ファイルは含
まれていない。そのため、自分で作成する必要がある! GetLatestVimScripts_dat
を参照。
VIM SF NET からの版 glvs-install
NOTE: 最後の手順、つまり GetLatestVimScripts.dist ファイルの名前の変更/移動は、
GetLatestVimScripts.tar.bz2 を初めてダウンロードした人のためのものである。
GetLatestVimScripts.dist ファイルは、あなた自身の個人用リストの例およびテンプ
レートとなる。その中に書かれているスクリプトはすべて自由に削除してよい。その
"重要な" 部分は最初の 2 行である。
GetLatestVimScripts が動作するには、コンピュータに wget か curl が必要である。
1. 圧縮されている場合: gunzip getscript.vmb.gz
2. Unix:
vim getscript.vmb
:so %
:q
cd ~/.vim/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(GetLatestVimScripts.dat を編集して、欲しいプラグインの個人用
リストをインストールする -- GetLatestVimScripts_dat を参照)
3. Windows:
vim getscript.vmb
:so %
:q
cd **path-to-vimfiles**/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(GetLatestVimScripts.dat を編集して、欲しいプラグインの個人用
リストをインストールする -- GetLatestVimScripts_dat を参照)
読み込みの防止
プラグインは使いたいが、何らかの理由で getscript は使いたくない場合は、以下を
vimrc に追加することで getscript プラグインの読み込みを避けられる:
:let g:loaded_getscriptPlugin = 1
==============================================================================
3. GetLatestVimScripts の使い方 glvs-usage :GLVS
他の場所で定義されていなければ
:GLVS
で GetLatestVimScripts() が起動する。他のプラグインがそのコマンドを定義してい
た場合は、次のようにタイプすればよい
:GetLatestVimScripts
このスクリプトは更新を試み、許可されていれば http://vim.sourceforge.net/ から
スクリプトを自動的にインストールする。そのために、ファイル
.vim/GetLatest/GetLatestVimScripts.dat (unix)
または
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
(glvs-data を参照) を精読し、あなたの [.vim|vimfiles]/plugin ディレクトリ内のプラグインを調べる (glvs-plugins を参照)。
ダウンロードされたスクリプトは
~/.vim/GetLatest (unix) または ..wherever..\vimfiles\GetLatest (windows)
サブディレクトリに現れる。<.vimrc> に以下の行がある場合、GetLatestVimScripts
はそれらを自動的にインストールしようとする:
let g:GetLatestVimScripts_allowautoinstall=1
GetLatestVimScripts.dat> ファイルは、そのようにダウンロードされたスクリプトの
最新版を反映するように自動的に更新される。
(glvs-options も参照)
==============================================================================
4. GetLatestVimScripts データファイル getscript-data glvs-data
:GetLatestVimScripts_dat
データファイル <GetLatestVimScripts.dat> は、最初の 2 行に以下のテキストがなけ
ればならない:
ScriptID SourceID Filename
--------------------------
--------------------------
その 2 行に続くのは 3 つの列である。最初の 2 つは数値で、その後にテキストの列
が続く。GetLatest/GetLatestVimScripts.dist ファイルには、そのようなデータファ
イルの例が含まれている。#... に続くものはすべて無視されるので、ファイルにコメ
ントを埋め込んでよい。
各行の最初の数値はスクリプトの ScriptID を与える。ウェブブラウザーを使って
http://vim.sf.net/ のスクリプトを見ようとするとき、スクリプトのリンクをクリッ
クする直前に、次のような行が見えるだろう
http://vim.sourceforge.net/scripts/script.php?script_id=40
この "40" がたまたま、GetLatestVimScripts が関連するページをダウンロードするの
に必要な ScriptID であり、プラグインの最初のアップロードの間に vim.sf.net 自身
によって割り当てられる。
各行の 2 番目の数値はスクリプトの SourceID を与える。SourceID は、vim.sf.net
が決めたアップロード済みスクリプトの数を記録している。そのため、スクリプトが
"いつ" アップロードされたかを示す役目を果たす。SourceID を 1 に設定すると、
GetLatestVimScripts は手元にあるスクリプトが古いとみなすことが保証される。
SourceID は、GetLatestVimScripts によって vim.sf.net のスクリプトのページから
取り出される。それが GetLatestVimScripts.dat ファイルに保存されているものより
大きいときは常に、スクリプトがダウンロードされる
(GetLatestVimScripts_dat を参照)。
スクリプトの作者が自分のプラグインに特別なコメント行を含めている場合は、そのプ
ラグイン自身が GetLatestVimScripts によって、それが持つかもしれない他のスクリ
プトへの依存関係も含めて、あなたの <GetLatestVimScripts.dat> ファイルを作成す
るのに使われる。例として、次を考える:
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
このコメント行は getscript.vim に、Vim script #884 をチェックすること、そして
そのスクリプトが自動的にインストール可能であることを伝える。Getscript はまた、
この行を使い、次のような行を含めることで GetLatestVimScripts.dat ファイルの作
成を助ける:
884 1 :AutoInstall: AutoAlign.vim
ただし、そのような行がまだ GetLatestVimScripts.dat ファイルにないと仮定しての
ことである。詳細は glvs-plugins を参照。このように、GetLatestVimScripts はこ
のように、あなたのプラグインを最新に保つ包括的な機能を提供する!
要約すると:
* 任意で、既にインストールされているプラグインに基づいて
GetLatestVimScripts.dat ファイルを作成/追記してよいことを getscript に伝え
る:
let g:GetLatestVimScripts_allowautoinstall=1
* 次のような行は
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
既にダウンロードされたプラグイン内で、getscript が AutoInstall してよいというプラグイン作者の同意を構成する。すべてのプラグインが AutoInstall 可能
とは限らず、自分のプラグインが正しく AutoInstall されるかどうかを知るのに
最も適した立場にいるのはプラグインの作者である。
* 次のような行は
884 1 :AutoInstall: AutoAlign.vim
GetLatestVimScripts.dat ファイル内で、getscript が AutoInstall することへのあなたの許可を構成する。AutoInstall にはあなたとプラグイン作者の両方の許
可が必要である。GetLatestVimScripts_dat を参照。
GetLatestVimScripts_dat
<GetLatestVimScripts.dat> ファイルの例として:
ScriptID SourceID Filename
--------------------------
294 1 :AutoInstall: Align.vim
120 2 Decho.vim
40 3 DrawIt.tar.gz
451 4 EasyAccents.vim
195 5 engspchk.vim
642 6 GetLatestVimScripts.vim
489 7 Manpageview.vim
--------------------------
294 1 :AutoInstall: Align.vim
120 2 Decho.vim
40 3 DrawIt.tar.gz
451 4 EasyAccents.vim
195 5 engspchk.vim
642 6 GetLatestVimScripts.vim
489 7 Manpageview.vim
Note: 最初の 2 行は必須だが、本質的にはコメントとして働く。
==============================================================================
5. GetLatestVimScripts 対応プラグイン getscript-plugins glvs-plugins
(この節はプラグイン作者向け)
プラグインの作者が自分のプラグイン内のどこかに以下のコメントを含めると、
GetLatestVimScripts はそれを見つけ、それを使ってユーザーの
GetLatestVimScripts.dat ファイルを自動的に作成する:
src_id
v
" GetLatestVimScripts: ### ### yourscriptname
^
scriptid
v
" GetLatestVimScripts: ### ### yourscriptname
^
scriptid
作者として、あなたは自分自身のスクリプトを参照するそのような行と、それが持つか
もしれないプラグインの依存関係を記述する追加の行を含めるべきである。もちろん同
じ形式で!
あなたのコマンドが自動インストール可能な場合 (glvs-autoinstall を参照)、ほと
んどのスクリプトはそうなのだが、"yourscriptname" の直前に :AutoInstall: を含め
てよい:
src_id
v
" GetLatestVimScripts: ### ### :AutoInstall: yourscriptname
^
scriptid
v
" GetLatestVimScripts: ### ### :AutoInstall: yourscriptname
^
scriptid
NOTE: :AutoInstall: 機能が動作するには、プラグイン作者と
ユーザーの両方の許可が必要である!
そして、それらのスクリプトの GetLatestVimScripts コマンドが、まだ存在しなけれ
ば、ユーザーの GetLatest/GetLatestVimScripts.dat ファイルに追加される。これは、
あなたのプラグインが依存するスクリプトの取得を自動化する、比較的手間のかからな
い方法である。
さて、作者としては、GetLatestVimScripts が自分のスクリプトを自分の手元のコピー
の上にダウンロードし、それによってまだリリースしていない苦労の成果を上書きして
しまうことは望まないだろう。GetLatestVimScripts はこれに対する解決策を提供して
いる: 次の行
0 0 yourscriptname
を <GetLatestVimScripts.dat> ファイルに入れると、GetLatestVimScripts は
"yourscriptname" スクリプトについて、それらの GetLatestVimScripts コメント行の
調査を飛ばす。その結果、それらの行がうっかり <GetLatestVimScripts.dat> ファイ
ルに入れられ、その後で自分のスクリプトのダウンロードに使われることはな
い。:AutoInstall: オプションを含めている場合は、これを行うことが特に重要であ
る。
必ず "0 0 yourscriptname" の行で、GetLatestVimScripts コメントで使ったのと同じ
"yourscriptname" を使うこと!
==============================================================================
6. GetLatestVimScripts AutoInstall getscript-autoinstall
glvs-autoinstall
GetLatestVimScripts は現在 "AutoInstall" をサポートしている。すべてのスクリプ
トが自動インストールに対応しているわけではない。インストールするために特別なこ
とをする必要がある場合があるからである (スクリプトの "install" の指示を参照)。
一方で、ほとんどのスクリプトは自動インストール可能である。
GetLatestVimScripts に自動インストールをさせるには、データファイルのコメント
フィールドが次で始まっていなければならない (前後の空白は無視される):
:AutoInstall:
両方のコロンが必要であり、それがコメント (yourscriptname) フィールドの先頭にな
ければならない。
<.vimrc> に以下の行を入れると、自動インストールをすべて防ぐことができる:
let g:GetLatestVimScripts_allowautoinstall= 0
デフォルトのとおり :AutoInstall: が有効な場合、次で終わり
---.tar.bz2 : .vim/ ディレクトリで解凍し untar する
---.vba.bz2 : .vim/ ディレクトリで解凍し、その後 vimball が処理する
---.vmb.bz2 : 同上
---.vim.bz2 : 解凍し .vim/plugin ディレクトリに移動する
---.tar.gz : .vim/ ディレクトリで解凍し untar する
---.vba.gz : .vim/ ディレクトリで解凍し、その後 vimball が処理する
---.vmb.gz : 同上
---.vim.gz : 解凍し .vim/plugin ディレクトリに移動する
---.vba : .vim/ ディレクトリに移動し、その後 vimball が処理する
---.vmb : 同上
---.vim : .vim/plugin ディレクトリに移動する
---.zip : .vim/ ディレクトリで unzip する
かつ untar/gunzip またはプラグインディレクトリへの移動の処理によって構成要素を
配置するだけでよいファイルは、自動インストール可能なはずである。もちろん、
Vimball は常に自動インストール可能なはずである。
スクリプトが自動インストール可能でないのはどんなときか? 例を挙げよう:
.vim/after/syntax/blockhl.vim
<blockhl.vim> スクリプトは C/C++ プログラムのブロックハイライトを提供する。次
から入手できる:
https://www.vim.org/scripts/script.php?script_id=104
現在、vim の after/syntax はファイルタイプ別のスクリプトしかサポートしていない
(blockhl.vim の場合、それは after/syntax/c.vim である)。そのため、自動インス
トールは現在のユーザーの after/syntax/c.vim ファイルを上書きしてしまう可能性が
ある。
私自身の場合は、after/syntax/c/ ディレクトリを使えるようにするために
<aftersyntax.vim> (after/syntax/c.vim に名前を変えたもの) を使っている:
https://www.vim.org/scripts/script.php?script_id=1023
このスクリプトにより、after/syntax/c サブディレクトリに複数の構文ファイルを別々
に置くことができる。その中に含まれる after/syntax/c.vim がユーザーの c.vim を
上書きする可能性があるため、aftersyntax.vim を同梱して自動インストール用の適切
な tarball を作ることはできない。
==============================================================================
7. GetLatestVimScripts オプション glvs-options
g:GetLatestVimScripts_wget
デフォルト= "wget"この変数は、スクリプトを取得するためのコマンドの名前を保持す
る。
g:GetLatestVimScripts_options
デフォルト= "-q -O"この変数は、g:GetLatestVimScripts_wget コマンドで使われるオプ
ションを保持する。
g:GetLatestVimScripts_allowautoinstall
デフォルト= 1この変数は、GetLatestVimScripts がスクリプトの自動インストール
を試みることが許されているかどうかを示す。さらに、プラグインの
作者が、自分のプラグインが自動インストール可能であることを
(GetLatestVimScripts コメント行の :AutoInstall: キーワードに
よって) 明示的に示していなければならない。
g:GetLatestVimScripts_autoinstalldir
デフォルト= $HOME/.vim (linux)デフォルト= $HOME/vimfiles (windows)
:AutoInstall: のスクリプトがインストールされる場所を上書きす
る。vimball のインストールは上書きしない。
g:GetLatestVimScripts_scriptaddr
デフォルト='https://www.vim.org/scripts/script.php?script_id=' g:GetLatestVimScripts_downloadaddr
デフォルト='https://www.vim.org/scripts/download_script.php?src_id=' g:GetLatestVimScripts_bunzip2
デフォルト= bunzip2この変数は、.bz2 ファイルを解凍するコマンドの名前を保持する
g:GetLatestVimScripts_bunzip3
デフォルト= bunzip3この変数は、.bz3 ファイルを解凍するコマンドの名前を保持する
g:GetLatestVimScripts_gunzip
デフォルト= gunzipこの変数は、.gz ファイルを解凍するコマンドの名前を保持する
g:GetLatestVimScripts_unxz
デフォルト= unxzこの変数は、.xz ファイルを解凍するコマンドの名前を保持する
g:GetLatestVimScripts_unzip
デフォルト= unzipこの変数は、.zip ファイルを解凍するコマンドの名前を保持する
Note: 解凍コマンドに関連する変数は、クロスプラットフォームの問題の回避に役立
つ。例えば、Windows では次のようにして、この呼び出しを wsl に委ねるこ
とが可能である:
let g:GetLatestVimScripts_bunzip2= "wsl -e bunzip2"
let g:GetLatestVimScripts_gunzip= "wsl -e gunzip"
let g:GetLatestVimScripts_unxz= "wsl -e unxz"
let g:GetLatestVimScripts_unzip= "wsl -e unzip"
let g:GetLatestVimScripts_gunzip= "wsl -e gunzip"
let g:GetLatestVimScripts_unxz= "wsl -e unxz"
let g:GetLatestVimScripts_unzip= "wsl -e unzip"
==============================================================================
8. GetLatestVimScripts アルゴリズム glvs-algorithm glvs-alg
Vim の sourceforge のページは、いわゆる script-id をキーにしてページを動的に作
成する。
https://www.vim.org/scripts/script.php?script_id=40
のウェブページ内には、最新の source-id (src_id) を指定する行がある。ソース識別
番号は常に増加していくので、src_id が GetLatestVimScripts にそのスクリプト用に
記録されているものより大きければ、そのスクリプトの新しいコピーをダウンロードす
る時である。
そして GetLatestVimScripts はスクリプトをダウンロードし、スクリプト ID、ソース
ID、スクリプト名の内部データベースを更新する。
AutoInstall の処理は次のことを行う:
ファイルを GetLatest/ から以下のディレクトリに移動する
Unix : $HOME/.vim
Windows: $HOME\vimfiles
ダウンロードしたファイルが ".bz2" で終わる場合
それを bunzip2 する
そうでなく、ダウンロードしたファイルが ".bz3" で終わる場合
それを bunzip3 する
そうでなく、ダウンロードしたファイルが ".gz" で終わる場合
それを gunzip する
結果のファイルが ".zip" で終わる場合
それを unzip する
そうでなく、結果のファイルが ".tar" で終わる場合
それを tar -oxvf する
そうでなく、結果のファイルが ".vim" で終わる場合
それを plugin サブディレクトリに移動する
==============================================================================
9. GetLatestVimScripts 履歴 getscript-history glvs-hist {{{1
v38 Feb 25, 2025 : * handles additional decompression option for .bzip3 files.
v37 Sep 23, 2024 : * Support for the new vimball's .vmb extension (old .vba
extension conflicted with visual basic).
* Support for glvs-autoinstall in ftplugins and packages.
* Allow platform driven customization of decompressing
commands.
v36 Apr 22, 2013 : * (glts) suggested use of plugin/**/*.vim instead of
plugin/*.vim in globpath() call.
* (Andy Wokula) got warning message when setting
g:loaded_getscriptPlugin
v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script URL has
changed (somewhat). However, it doesn't work, and
the original one does (under Linux). I'll make it
yet-another-option.
v34 Jun 23, 2011 : * handles additional decompression options for tarballs
(tgz taz tbz txz)
v33 May 31, 2011 : * using fnameescape() instead of escape()
* *.xz support
v32 Jun 19, 2010 : * (Jan Steffens) added support for xz compression
v31 Jun 29, 2008 : * (Bill McCarthy) fixed having hls enabled with getscript
* (David Schaefer) the acd option interferes with vimballs
Solution: bypass the acd option
v30 Jun 13, 2008 : * GLVS now checks for existence of fnameescape() and will
issue an error message if it is not supported
v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
getscriptPlugin.vim was setting it but not restoring it.
v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
interface, register-a bypass
Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
creating pop-up windows
v24 Apr 16, 2007 : * removed save&restore of the fo option during script
loading
v23 Nov 03, 2006 : * ignores comments (#...)
* handles vimballs
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
available
v21 May 01, 2006 : * now takes advantage of autoloading.
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
unzip needs the -o flag to overwrite.
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
script! Fixed.
v18 Mar 21, 2005 : * bugfix to automatic database construction
* bugfix - nowrapscan caused an error
(tnx to David Green for the fix)
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
:AutoInstall:s, even though its o/s is windows
Apr 01, 2005 * when downloading errors occurred, GLVS was
terminating early. It now just goes on to trying
the next script (after trying three times to
download a script description page)
Apr 20, 2005 * bugfix - when a failure to download occurred,
GetLatestVimScripts would stop early and claim that
everything was current. Fixed.
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
defaults to 1, can be used to prevent all
:AutoInstall:
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
* fixed bug with :AutoInstall: use of helptags
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
always preventing downloads (just usually). Fixed.
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
s:dotvim. Fixed.
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
is zero. Useful for script authors; that way their
own GetLatestVimScripts activity won't overwrite
their scripts.
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
was intended only for testing. Removed, now works.
* :AutoInstall: implemented
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
* :GetLatestVimScripts command
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
now holds scripts that need updating
v10 Apr 19, 2004 : * moved history from script to doc
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
double quotes ("") whereas other systems will use
single quotes ('') around the urls in calls via wget
v8 Dec 01, 2003 : makes three tries at downloading
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
not found in downloaded webpage
Uses t_ti, t_te, and rs to make progress visible
v6 Aug 06, 2003 : final status messages now display summary of work
( "Downloaded someqty scripts" or
"Everything was current")
Now GetLatestVimScripts is careful about downloading
GetLatestVimScripts.vim itself!
(goes to <NEW_GetLatestVimScripts.vim>)
v5 Aug 04, 2003 : missing an endif near bottom
v4 Jun 17, 2003 : redraw! just before each "considering" message
v3 May 27, 2003 : Protects downloaded files from errant shell
expansions with single quotes: '...'
v2 May 14, 2003 : extracts name of item to be obtained from the
script file. Uses it instead of comment field
for output filename; comment is used in the
"considering..." line and is now just a comment!
* Fixed a bug: a string-of-numbers is not the
same as a number, so I added zero to them
and they became numbers. Fixes comparison.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:fdm=marker