Merge branch 'KaoriYa'
[MacVim/KaoriYa.git] / runtime / doc / pi_getscript.jax
blob4b073f9465ab83dd0ed220b32f91d83e53349d72
1 *pi_getscript.txt*  For Vim バージョン 7.2.  Last change: 2008 Jun 29
3                 GETSCRIPT REFERENCE MANUAL  by Charles E. Campbell, Jr.
5 Authors:  Charles E. Campbell, Jr.  <NdrOchip@ScampbellPfamilyA.Mbiz>
6           (remove NOSPAM from the email address)
7                                                 *GetLatestVimScripts-copyright*
8 Copyright: (c) 2004-2006 by Charles E. Campbell, Jr.    *glvs-copyright*
9            The VIM LICENSE applies to getscript.vim and
10            pi_getscript.txt (see |copyright|) except use
11            "getscript" instead of "Vim".  No warranty, express or implied.
12            Use At-Your-Own-Risk.
14 Getscript はあなたが使っている Vim スクリプトの最新バージョンを簡単に検索する
15 ためのプラグインです。|:GLVS| と入力すると getscript が実行されます。すると、
16 <GetLatestVimScripts.dat> ファイル (|GetLatestVimScripts_dat|参照) に列挙され
17 たスクリプトの最新バージョンが http://vim.sf.net/ から取得されます。
19 ==============================================================================
20 1. 目次                                   *glvs-contents* *glvs* *getscript*
21                                         *GetLatestVimScripts*
23         1. 目次............................................: |glvs-contents|
24         2. GetLatestVimScripts -- 準備.....................: |glvs-install|
25         3. GetLatestVimScripts の使い方....................: |glvs-usage|
26         4. GetLatestVimScripts データファイル..............: |glvs-data|
27         5. GetLatestVimScripts 対応プラグイン..............: |glvs-plugins|
28         6. GetLatestVimScripts 自動インストール............: |glvs-autoinstall|
29         7. GetLatestViMScripts オプション..................: |glvs-options|
30         8. GetLatestVimScripts アルゴリズム................: |glvs-alg|
31         9. GetLatestVimScripts 開発履歴....................: |glvs-hist|
34 ==============================================================================
35 2. GetLatestVimScripts -- 準備                            *getscript-start*
36                                                 *getlatestvimscripts-install*
38         Vim に付属の getscript                              *glvs-dist-install*
40 Vim 7.0 には GetLatestVimScripts.dist (サンプルファイル) が付属していないの
41 で、自分で作成する必要があります。|GetLatestVimScripts_dat| 参照。
43         vim.sf.net から入手した getscript             *glvs-install*
45 NOTE: GetLatestVimScripts.dist のコピーは、初めて getscript をインストールする
46 ときだけ必要です。
48 GetLatestVimScripts.dist は自分の一覧を作成するためのサンプルまたはテンプレー
49 トとして使ってください。ファイルにはスクリプトがいくつか列挙されていますが、必
50 要なければ消してください。重要なのはファイル先頭の二行だけです。
52 GetLatestVimScripts の動作には wget が必要です。
54         1. ファイルが圧縮されている場合:  gunzip getscript.vba.gz
55         2. Unix:
56                 vim getscript.vba
57                 :so %
58                 :q
59                 cd ~/.vim/GetLatest
60                 mv GetLatestVimScripts.dist GetLatestVimScripts.dat
61                 (GetLatestVimScripts.dat を編集して、インストールしたいプラグ
62                 インの一覧を書いてください。|GetLatestVimScripts_dat| 参照)
64         3. Windows:
65                 vim getscript.vba
66                 :so %
67                 :q
68                 cd **path-to-vimfiles**/GetLatest
69                 mv GetLatestVimScripts.dist GetLatestVimScripts.dat
70                 (GetLatestVimScripts.dat を編集して、インストールしたいプラグ
71                 インの一覧を書いてください。|GetLatestVimScripts_dat| 参照)
74 ==============================================================================
75 3. GetLatestVimScripts の使い方                             *glvs-usage* *:GLVS*
77 次のコマンドを実行すると GetLatestVimScripts() が呼び出されます >
78         :GLVS
79 同じ名前のコマンドが他のプラグインによって定義されている場合は、次のコマンドを
80 使ってください
82         :GetLatestVimScripts
84 このコマンドは http://vim.sourceforge.net/ をチェックしてスクリプトを更新し、
85 許可がある場合はそれを自動的にインストールします。そのために次のファイルが使わ
86 れます:
88         .vim/GetLatest/GetLatestVimScripts.dat                    (unix)
90 or >
91         ..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat   (windows)
92 (|glvs-data|参照)。そして、[.vim|vimfiles]/plugin ディレクトリ内のプラグインが
93 検査されます (|glvs-plugins|参照)。
95 ダウンロードされたスクリプトは
96 ~/.vim/GetLatest (unix) or ...\vimfiles\GetLatest (windows)
97 に保存されます。vimrc ファイルに次の設定を書いておくと、ダウンロードしたスクリ
98 プトが自動的にインストールされます: >
100         let g:GetLatestVimScripts_allowautoinstall=1
102 <GetLatestVimScripts.dat> ファイルは自動的に更新され、ダウンロードした最新スク
103 リプトのバージョンが反映されます。
104 (|glvs-options|も参照)
107 ==============================================================================
108 4. GetLatestVimScripts データファイル          *getscript-data* *glvs-data*
109                                                 *:GetLatestVimScripts_dat*
110 <GetLatestVimScripts.dat> ファイルの先頭二行は次のようなテキストになっていま
111 す:
113         ScriptID SourceID Filename
114         --------------------------
116 その下に三列 (数値 数値 テキスト) の行が続きます。
117 GetLatest/GetLatestVimScripts.dist ファイルはそのようなデータファイルの例に
118 なっています。コメントは #... で書くことができます。
120 一列目の数値はスクリプトの ScriptID です。Web ブラウザで http://vim.sf.net/ に
121 あるスクリプトを探すとき、スクリプトへのリンクにマウスカーソルを合わせると、次
122 のような url が確認できますが
124         http://vim.sourceforge.net/scripts/script.php?script_id=40
126 この "40" が ScriptID です。GetLatestVimScripts はこの番号を使ってスクリプトの
127 ページにアクセスします。
129 二列目の数値はスクリプトの SourceID です。SourceID は vim.sf.net にスクリプト
130 がアップロードされるごとに新しい番号が付けられます。したがって、その番号を見れ
131 ばスクリプトがアップロードされた時期が分かります。SourceID に 1 を指定すると、
132 そのスクリプトがまだ最新版に更新されていないということを明示できます。
134 GetLatestVimScripts は、vim.sf.net のスクリプトのページから SourceID を抜き出
135 して、それが GetLatestVimScripts.dat に記録された番号よりも大きいようなら、そ
136 のスクリプトをダウンロードします。
137 (|GetLatestVimScripts_dat|参照)
139 スクリプトの作者が、プラグインに特殊なコメント行を書いていた場合、そのコメント
140 行を使って <GetLatestVimScripts.dat> が生成されます。スクリプトの依存関係も処
141 理されます。例: >
143         " GetLatestVimScripts: 884  1 :AutoInstall: AutoAlign.vim
145 このコメントは、チェックすべきスクリプトの番号が 884 番であること、そのスクリ
146 プトが自動インストール可能であることを示しています。getscript はこの情報を
147 GetLatestVimScripts.dat に保存します。次のような行になります: >
149         884 1 AutoAlign.vim
151 詳細は |glvs-plugins| を参照してください。このように、GetLatestVimScripts はプ
152 ラグインを更新するための包括的な機能を提供しています。
154                                                 *GetLatestVimScripts_dat*
155 <GetLatestVimScripts.dat> ファイルの例:
157     ScriptID SourceID Filename
158     --------------------------
159     294 1 Align.vim
160     120 2 decho.vim
161      40 3 DrawIt.tar.gz
162     451 4 EasyAccents.vim
163     195 5 engspchk.vim
164     642 6 GetLatestVimScripts.vim
165     489 7 Manpageview.vim
167 Note: 最初の二行は必須です。ただしコメントと同様に無視されます。
170 ==============================================================================
171 5. GetLatestVimScripts 対応プラグイン  *getscript-plugins* *glvs-plugins*
173 プラグインの作者がプラグインのどこかに以下のようなコメントを書いていた場合、
174 GetLatestVimScripts はそれを見付けて、GetLatestVimScripts.dat ファイルの構築に
175 使います:
177                                  src_id
178                                     v
179         " GetLatestVimScripts: ### ### yourscriptname
180                                 ^
181                             scriptid
183 プラグインの作者は、上記のような行を書いて自分のプラグインを参照させてくださ
184 い。複数行書けるので、依存している別のプラグインを参照することもできます。その
185 場合でも書式は同じです。
187 プラグインが自動インストール可能 (|glvs-autoinstall|参照) なら (ほとんどのスク
188 リプトはそうだと思いますが)、"yourscriptname" の前に :AutoInstall: を指定する
189 ことができます。
191 GetLatestVimScripts 命令が未登録の場合は、ユーザーの
192 GetLatest/GetLatestVimScripts.dat ファイルに追加されます。あなたのプラグインが
193 依存しているスクリプトのインストールを比較的簡単に自動化できます。
195 プラグインの作者の方は、自分の環境で自分のプラグインをダウンロードしたくはない
196 と思います。リリース前の作業中のスクリプトが上書きされると困りますよね。それを
197 防ぐための仕組みが用意されています。次の行を <GetLatestVimScripts.dat> に書い
198 てください:
200         0 0 yourscriptname
202 スクリプト "yourscriptname" に対する GetLatestVimScript 命令は処理されなくなり
203 ます。その命令行は <GetLatestVimScripts.dat> には登録されず、スクリプトはダウ
204 ンロードされません。これは :AutoInstall: を指定しているときには特に重要です。
206 "0 0 yourscriptname" の指定ではスクリプトに書かれた "yourscriptname" と同じ名
207 前を使ってください。
210 ==============================================================================
211 6. GetLatestVimScripts 自動インストール                 *getscript-autoinstall*
212                                                         *glvs-autoinstall*
214 GetLatestVimScripts には自動インストール機能があります。スクリプトによってはイ
215 ンストールに特別な作業が必要なものもありますが (各スクリプトのインストール方法
216 を確認してください)、ほとんどのスクリプトは自動インストール可能です。
218 自動インストールするには、データファイルのコメントフィールドを次のテキストで開
219 始してください (前後の空白は無視されます): >
221         :AutoInstall:
223 両端のコロンは必須です。必ずコメントフィールド (yourscriptname) の先頭に書いて
224 ください。
226 以下の行を <.vimrc> に書くと、自動インストール機能を無効にできます: >
228         let g:GetLatestVimScripts_allowautoinstall= 0
230 :AutoInstall: が有効になっている場合 (初期設定)、次のような拡張子のファイルが
231 自動インストール可能です:
233         ---.tar.bz2  : 伸長して .vim/ ディレクトリに展開
234         ---.vba.bz2  : 伸長して .vim/ ディレクトリにコピー、vimball で処理
235         ---.vim.bz2  : 伸長して .vim/plugin ディレクトリにコピー
236         ---.tar.gz   : 伸長して .vim/ 展開
237         ---.vba.gz   : 伸長して .vim/ ディレクトリにコピー、vimball で処理
238         ---.vim.gz   : 伸長して .vim/plugin ディレクトリにコピー
239         ---.vba      : .vim/ ディレクトリに展開
240         ---.vim      : .vim/plugin にコピー
241         ---.zip      : .vim/ ディレクトリに展開
243 ただし、圧縮ファイルを展開するか、あるいはファイルをプラグインディレクトリにコ
244 ピーするだけでインストール可能である必要があります。Vimball は常に自動インス
245 トール可能です。
247 自動インストールできないのはどんな場合でしょうか? 例を示します:
249         .vim/after/syntax/blockhl.vim
251 <blockhl.vim> は C/C++ のブロックを強調表示するスクリプトです。次の場所から入
252 手できます:
254         http://vim.sourceforge.net/scripts/script.php?script_id=104
256 現在、Vim の after/syntax はファイルタイプと同じ名前のスクリプトしかサポートし
257 てません (blockhl.vim の場合は、after/syntax/c.vim)。そのため、自動的にインス
258 トールすると、ユーザーの after/syntax/c.vim を上書きする可能性があります。
260 私は個人的に、<aftersyntax.vim> を after/syntax/c.vim にコピーして、
261 after/syntax/c/ ディレクトリを使えるようにしています:
263         http://vim.sourceforge.net/scripts/script.php?script_id=1023
265 このスクリプトを使うと、after/syntax/c ディレクトリにある複数のファイルをシン
266 タックスファイルとして使えます。ユーザーの after/syntax/c.vim を上書きしてしま
267 う可能性があるため、配布物には含めていません。
270 ==============================================================================
271 7. GetLatestVimScripts オプション                            *glvs-options*
273         g:GetLatestVimScripts_wget
274 <       初期設定: "wget"
275                 スクリプトをダウンロードするのに使われるプログラム。
277         g:GetLatestVimScripts_options
278 <       初期設定: "-q -O"
279                 g:GetLatestVimScripts_wget に設定されたプログラムの起動引数。
281         g:getLatestVimScripts_allowautoinstall
282 <       初期設定: 1
283                 スクリプトの自動インストールを許可するかどうかの設定。
284                 Note: vimball はまだ未対応。自動インストールは、プラグインの作
285                 者によって、そのプラグインが自動インストール可能であることが明
286                 示されている必要があります。
289 ==============================================================================
290 8. GetLatestVimScripts アルゴリズム           *glvs-algorithm* *glvs-alg*
292 Vim の Web サイトでは、スクリプトID を利用してページを動的に生成しています。
294         http://vim.sourceforge.net/scripts/script.php?script_id=40
296 ページ内には最新の ソースID が書かれています。ソースID の番号は再利用されない
297 ので、その番号が、GetLatestVimScripts.dat に記録された番号より大きい場合は、新
298 しいスクリプトがダウンロードできるということです。
300 スクリプトをダウンロードしたら、内部データベースの ScriptID、SourceID、
301 scriptname を更新します。
303 自動インストールの手順は次の通り:
305         ファイルを GetLatest/ から以下のディレクトリに移動する
306                 Unix   : $HOME/.vim
307                 Windows: $HOME\vimfiles
308         if ファイルの拡張子 == ".bz2"
309                 bunzip2 <file>
310         else if ファイルの拡張子 == ".gz"
311                 gunzip <file>
312         そして、
313         if ファイルの拡張子 == ".zip"
314                 unzip <file>
315         else if ファイルの拡張子 == ".tar"
316                 tar -oxvf <file>
317         else if ファイルの拡張子 == ".vim"
318                 plugin ディレクトリに移動
321 ==============================================================================
322 9. GetLatestVimScripts 開発履歴             *getscript-history* *glvs-hist* {{{1
324 v31 Jun 29, 2008 : * (Bill McCarthy) fixed having hls enabled with getscript
325 v30 Jun 13, 2008 : * GLVS now checks for existence of fnameescape() and will
326                      issue an error message if its not supported
327 v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
328                      getscriptPlugin.vim was setting it but not restoring it.
329 v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
330                      interface, register-a bypass
331     Oct 29, 2007   * Bill McCarthy suggested a change to getscript that avoids
332                      creating pop-up windows
333 v24 Apr 16, 2007 : * removed save&restore of the fo option during script
334                      loading
335 v23 Nov 03, 2006 : * ignores comments (#...)
336                    * handles vimballs
337 v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
338                      available
339 v21 May 01, 2006 : * now takes advantage of autoloading.
340 v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
341                      unzip needs the -o flag to overwrite.
342 v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
343                      script! Fixed.
344 v18 Mar 21, 2005 : * bugfix to automatic database construction
345                    * bugfix - nowrapscan caused an error
346                      (tnx to David Green for the fix)
347     Apr 01, 2005   * if shell is bash, "mv" instead of "ren" used in
348                      :AutoInstall:s, even though its o/s is windows
349     Apr 01, 2005   * when downloading errors occurred, GLVS was
350                      terminating early.  It now just goes on to trying
351                      the next script (after trying three times to
352                      download a script description page)
353     Apr 20, 2005   * bugfix - when a failure to download occurred,
354                      GetLatestVimScripts would stop early and claim that
355                      everything was current.  Fixed.
356 v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
357                      defaults to 1, can be used to prevent all
358                      :AutoInstall:
359 v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
360                    * fixed bug with :AutoInstall: use of helptags
361 v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
362                      always preventing downloads (just usually).  Fixed.
363 v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
364                      s:dotvim.  Fixed.
365 v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
366                      is zero.  Useful for script authors; that way their
367                      own GetLatestVimScripts activity won't overwrite
368                      their scripts.
369 v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
370                      was intended only for testing.  Removed, now works.
371                    * :AutoInstall: implemented
372 v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
373                    * :GetLatestVimScripts command
374                    * (runtimepath)/GetLatest/GetLatestVimScripts.dat
375                      now holds scripts that need updating
376 v10 Apr 19, 2004 : * moved history from script to doc
377 v9  Jan 23, 2004 :   windows (win32/win16/win95) will use
378                      double quotes ("") whereas other systems will use
379                      single quotes ('') around the urls in calls via wget
380 v8  Dec 01, 2003 :   makes three tries at downloading
381 v7  Sep 02, 2003 :   added error messages if "Click on..." or "src_id="
382                      not found in downloaded webpage
383                      Uses t_ti, t_te, and rs to make progress visible
384 v6  Aug 06, 2003 :   final status messages now display summary of work
385                      ( "Downloaded someqty scripts" or
386                        "Everything was current")
387                      Now GetLatestVimScripts is careful about downloading
388                      GetLatestVimScripts.vim itself!
389                      (goes to <NEW_GetLatestVimScripts.vim>)
390 v5  Aug 04, 2003 :   missing an endif near bottom
391 v4  Jun 17, 2003 :   redraw! just before each "considering" message
392 v3  May 27, 2003 :   Protects downloaded files from errant shell
393                      expansions with single quotes: '...'
394 v2  May 14, 2003 :   extracts name of item to be obtained from the
395                      script file.  Uses it instead of comment field
396                      for output filename; comment is used in the
397                      "considering..." line and is now just a comment!
398                    * Fixed a bug: a string-of-numbers is not the
399                      same as a number, so I added zero to them
400                      and they became numbers.  Fixes comparison.
402 ==============================================================================
403 vim:tw=78:ts=8:ft=help:fdm=marker