@@ -457,7 +457,7 @@ Vimスクリプトのパッケージは1つかそれ以上のプラグインを
457
457
簡素化する。
458
458
- パッケージはお互いに依存する複数のプラグインを含むことができる。
459
459
- パッケージは起動時に自動的に読み込まれるプラグインと、必要になった時のみ
460
- `:packadd ` により読み込まれるプラグインを含むことができる。
460
+ `:packadd ` により読み込まれるプラグインを含むことができる。
461
461
462
462
463
463
パッケージの使用と自動読み込み ~
@@ -480,7 +480,7 @@ Vimスクリプトのパッケージは1つかそれ以上のプラグインを
480
480
Vim が起動した時、.vimrcを処理した後、'packpath' に含まれる "pack/*/start" ディ
481
481
レクトリの下の全てのディレクトリをスキャンする。最初にそのディレクトリは
482
482
'runtimepath' に追加される。次に全てのプラグインがロードされる。
483
- See | packload-two-steps | for how these two steps can be useful.
483
+ これら2つのステップがどのように役立つかについては、 | packload-two-steps | 参照。
484
484
485
485
上記の例では "pack/foo/start/foobar/plugin/foo.vim" を見つけて
486
486
"~/.vim/pack/foo/start/foobar" を 'runtimepath' に追加する。
@@ -503,121 +503,121 @@ Note "pack/foo/opt" 以下のファイルは自動的に読み込まれず、"pa
503
503
これはプラグインの読み込みを無効化していても効果がある。自動読み込みは一度だけ
504
504
行われる。
505
505
506
- If the package has an "after" directory, that directory is added to the end of
507
- 'runtimepath' , so that anything there will be loaded later.
506
+ パッケージに "after" ディレクトリがある場合、そのディレクトリは 'runtimepath'
507
+ の末尾に追加される。そのため、そこにあるものは全て後でロードされる。
508
508
509
509
510
- Using a single plugin and loading it automatically ~
510
+ 単一のプラグインを自動的にロードして使用する ~
511
511
512
- If you don't have a package but a single plugin, you need to create the extra
513
- directory level:
512
+ パッケージでなく単一のプラグインがある場合は、余分なディレクトリ階層を作成する
513
+ 必要がある。
514
514
% mkdir -p ~/.vim/pack/foo/start/foobar
515
515
% cd ~/.vim/pack/foo/start/foobar
516
516
% unzip /tmp/someplugin.zip
517
517
518
- You would now have these files:
518
+ これで、次のファイルが作成される。
519
519
pack/foo/start/foobar/plugin/foo.vim
520
520
pack/foo/start/foobar/syntax/some.vim
521
521
522
- From here it works like above.
522
+ ここから上のように動作する。
523
523
524
524
525
525
任意のプラグイン ~
526
526
*pack-add*
527
- 上記の pack ディレクトリから任意のプラグインをロードするには`:packadd ` コマンド
528
- を使う : >
527
+ 上記の pack ディレクトリから任意のプラグインをロードするには `:packadd ` コマン
528
+ ドを使う : >
529
529
:packadd foodebug
530
530
これは 'packpath' の "pack/*/opt/foodebug" から
531
531
~/.vim/pack/foo/opt/foodebug/plugin/debugger.vim を見つけ読み込む。
532
532
533
- This could be done if some conditions are met. For example, depending on
534
- whether Vim supports a feature or a dependency is missing.
533
+ これにより何かしらの条件が満たされる時に実行されるようにできる。例えば、Vim が
534
+ ある機能をサポートしているかどうかとか、依存したモノが見つからないとか、そうい
535
+ うことに依存させることができる。
535
536
536
- You can also load an optional plugin at startup, by putting this command in
537
- your | .vimrc | : >
537
+ このコマンドをあなたの | .vimrc | に入れることで、起動時に任意のプラグインを読み
538
+ 込むこともできる。
538
539
:packadd! foodebug
539
- The extra "!" is so that the plugin isn't loaded if Vim was started with
540
- | --noplugin | .
540
+ 余分な "!" は Vim が | --noplugin | で起動されていれば、プラグインがロードされな
541
+ いようにするためである。
541
542
542
543
パッケージが "opt" ディレクトリしか持たなかったとしても一向に構わない。その場
543
544
合、それを使いたいときは(明示的に)読み込む必要がある。
544
545
545
546
546
547
どこに何を置くか ~
547
548
548
- Since color schemes, loaded with `:colorscheme ` , are found below
549
- "pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend
550
- you put them below "pack/*/opt", for example
551
- ".vim/pack/mycolors/opt/dark/colors/very_dark.vim".
549
+ `:colorscheme ` で読み込まれるカラースキームは "pack/*/start" と "pack/*/opt"
550
+ の下から探し出されるのでどこにでも置くことができる。たとえば、
551
+ ".vim/pack/mycolors/opt/dark/colors/very_dark.vim" のように、 "pack/*/opt" の下
552
+ に置くことをお勧めする。
552
553
553
- Filetype plugins should go under "pack/*/start", so that they are always
554
- found. Unless you have more than one plugin for a file type and want to
555
- select which one to load with `:packadd ` . E.g. depending on the compiler
556
- version: >
554
+ Filetype プラグインはファイルタイプに複数のプラグインがあり、`:packadd ` でロー
555
+ ドするプラグインを選択したいのでない限り "pack/*/start" の下に置く必要がある。
556
+ 例えば、コンパイラのバージョンに依存する場合: >
557
557
if foo_compiler_version > 34
558
558
packadd foo_new
559
559
else
560
560
packadd foo_old
561
561
endif
562
562
563
- The "after" directory is most likely not useful in a package. It's not
564
- disallowed though.
563
+ "after" ディレクトリはパッケージで使うには十中八九便利ではない。しかし、使用が
564
+ 禁じられているわけではない。
565
565
566
566
==============================================================================
567
567
6. Vimパッケージを作る *package-create*
568
568
569
- This assumes you write one or more plugins that you distribute as a package.
570
-
571
- If you have two unrelated plugins you would use two packages, so that Vim
572
- users can chose what they include or not. Or you can decide to use one
573
- package with optional plugins, and tell the user to add the ones he wants with
574
- `: packadd ` .
575
-
576
- Decide how you want to distribute the package. You can create an archive or
577
- you could use a repository. An archive can be used by more users, but is a
578
- bit harder to update to a new version. A repository can usually be kept
579
- up-to-date easily, but it requires a program like "git" to be available.
580
- You can do both, github can automatically create an archive for a release.
581
-
582
- Your directory layout would be like this:
583
- start/foobar/plugin/foo.vim " always loaded, defines commands
584
- start/foobar/plugin/bar.vim " always loaded, defines commands
585
- start/foobar/autoload/foo.vim " loaded when foo command used
586
- start/foobar/doc/foo.txt " help for foo.vim
587
- start/foobar/doc/tags " help tags
588
- opt/fooextra/plugin/extra.vim " optional plugin, defines commands
589
- opt/fooextra/autoload/extra.vim " loaded when extra command used
590
- opt/fooextra/doc/extra.txt " help for extra.vim
591
- opt/fooextra/doc/tags " help tags
592
-
593
- This allows for the user to do: >
569
+ パッケージとして配布する1つ以上のプラグインを記述していることを前提とする。
570
+
571
+ 2つの無関係なプラグインがある場合は、2つのパッケージを使用するので、Vimユー
572
+ ザーはそのパッケージに含まれるものを選択できる。あるいは、オプションのプラグイ
573
+ ンで1つのパッケージを使用し、 `: packadd ` で必要なプラグインを追加するようにユー
574
+ ザーに指示することもできる。
575
+
576
+ パッケージの配布方法を決める。アーカイブを作成することも、リポジトリを使用する
577
+ こともできる。より多くのユーザーがアーカイブを使用できるが、新しいバージョンに
578
+ 更新するのは少し難しくなる。リポジトリは通常、最新の状態に保つことができるが、
579
+ "git" のようなプログラムが必要である。github ではリリースを作成すると自動的に
580
+ アーカイブが作られるので、あなたは両方を同時に行うことができる。
581
+
582
+ ディレクトリ構成は次のようになる。 >
583
+ start/foobar/plugin/foo.vim " 常にロードされ、コマンドを定義する
584
+ start/foobar/plugin/bar.vim " 常にロードされ、コマンドを定義する
585
+ start/foobar/autoload/foo.vim " fooコマンドを使用した時に読み込む
586
+ start/foobar/doc/foo.txt " foo.vimのヘルプ
587
+ start/foobar/doc/tags " ヘルプタグ
588
+ opt/fooextra/plugin/extra.vim " オプションのプラグイン、コマンド定義
589
+ opt/fooextra/autoload/extra.vim " extraコマンドを使用した時に読み込む
590
+ opt/fooextra/doc/extra.txt " extra.vimのヘルプ
591
+ opt/fooextra/doc/tags " ヘルプタグ
592
+
593
+ これにより、ユーザーは次の操作を行うことができる。 >
594
594
mkdir ~/.vim/pack/myfoobar
595
595
cd ~/.vim/pack/myfoobar
596
596
git clone https://github.com/you/foobar.git
597
597
598
- Here "myfoobar" is a name that the user can choose, the only condition is that
599
- it differs from other packages.
598
+ ここで "myfoobar" はユーザーが選択できる名前だが、唯一の条件は他のパッケージと
599
+ は異なることである。
600
600
601
- In your documentation you explain what the plugins do, and tell the user how
602
- to load the optional plugin: >
601
+ ドキュメントでは、プラグインの機能について説明し、オプションのプラグインをロー
602
+ ドする方法をユーザーに伝える。 >
603
603
:packadd! fooextra
604
604
605
- You could add this packadd command in one of your plugins, to be executed when
606
- the optional plugin is needed.
605
+ このpackaddコマンドをプラグインの1つに追加して、オプションのプラグインが必要な
606
+ ときに実行することができる。
607
607
608
- Run the `:helptags ` command to generate the doc/tags file. Including this
609
- generated file in the package means that the user can drop the package in his
610
- pack directory and the help command works right away. Don't forget to re-run
611
- the command after changing the plugin help: >
608
+ `:helptags ` コマンドを実行して、 doc/tags ファイルを生成する。この生成されたファ
609
+ イルをパッケージに含めるということは、パッケージディレクトリにパッケージを落と
610
+ すことができ、ヘルプコマンドがすぐに動作することを意味する。プラグインヘルプを
611
+ 変更した後にコマンドを再実行することを忘れないでほしい。 >
612
612
:helptags path/start/foobar/doc
613
613
:helptags path/opt/fooextra/doc
614
614
615
615
616
- Dependencies between plugins ~
616
+ プラグイン間の依存関係 ~
617
617
*packload-two-steps*
618
- Suppose you have two plugins that depend on the same functionality. You can
619
- put the common functionality in an autoload directory, so that it will be
620
- found automatically. Your package would have these files:
618
+ 同じ機能に依存する2つのプラグインがあるとする。共通機能を autoload ディレクト
619
+ リに置くことで、自動的に見つかるようにすることができる。あなたのパッケージには
620
+ 次のファイルがあるとする。
621
621
622
622
pack/foo/start/one/plugin/one.vim >
623
623
call foolib#getit()
@@ -626,8 +626,8 @@ found automatically. Your package would have these files:
626
626
< pack/foo/start/lib/autoload/foolib.vim >
627
627
func foolib#getit()
628
628
629
- This works, because loading packages will first add all found directories to
630
- 'runtimepath' before sourcing the plugins.
629
+ これは動作する。なぜなら、パッケージをロードすると、プラグインを読み込む前に見
630
+ つかったすべてのディレクトリが 'runtimepath' に追加されるからである。
631
631
632
632
==============================================================================
633
633
7. スクリプトのデバッグ *debug-scripts*
0 commit comments