Mercurial > vim
comparison runtime/doc/repeat.txt @ 8440:4c6ad81d41fe
commit https://github.com/vim/vim/commit/5f148ec0b5a6cedd9129b3abac351034b83cc4f7
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 7 22:59:26 2016 +0100
Update runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 07 Mar 2016 23:00:08 +0100 |
parents | 1a6527cce675 |
children | aec051e61547 |
comparison
equal
deleted
inserted
replaced
8439:e2c8b6671ec0 | 8440:4c6ad81d41fe |
---|---|
1 *repeat.txt* For Vim version 7.4. Last change: 2016 Mar 04 | 1 *repeat.txt* For Vim version 7.4. Last change: 2016 Mar 07 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
418 5. Using Vim packages *packages* | 418 5. Using Vim packages *packages* |
419 | 419 |
420 A Vim package is a directory that contains one or more plugins. The | 420 A Vim package is a directory that contains one or more plugins. The |
421 advantages over normal plugins: | 421 advantages over normal plugins: |
422 - A package can be downloaded as an archive and unpacked in its own directory. | 422 - A package can be downloaded as an archive and unpacked in its own directory. |
423 That makes it easy to updated and/or remove. | 423 Thus the files are not mixed with files of other plugins. That makes it |
424 easy to update and remove. | |
424 - A package can be a git, mercurial, etc. repository. That makes it really | 425 - A package can be a git, mercurial, etc. repository. That makes it really |
425 easy to update. | 426 easy to update. |
426 - A package can contain multiple plugins that depend on each other. | 427 - A package can contain multiple plugins that depend on each other. |
427 - A package can contain plugins that are automatically loaded on startup and | 428 - A package can contain plugins that are automatically loaded on startup and |
428 ones that are only loaded when needed with `:loadplugin`. | 429 ones that are only loaded when needed with `:packadd`. |
430 | |
431 | |
432 Using a package and loading automatically ~ | |
429 | 433 |
430 Let's assume your Vim files are in the "~/.vim" directory and you want to add a | 434 Let's assume your Vim files are in the "~/.vim" directory and you want to add a |
431 package from a zip archive "/tmp/mypack.zip": | 435 package from a zip archive "/tmp/foopack.zip": |
432 % mkdir -p ~/.vim/pack/my | 436 % mkdir -p ~/.vim/pack/foo |
433 % cd ~/.vim/pack/my | 437 % cd ~/.vim/pack/foo |
434 % unzip /tmp/mypack.zip | 438 % unzip /tmp/foopack.zip |
435 | 439 |
436 The directory name "my" is arbitrary, you can pick anything you like. | 440 The directory name "foo" is arbitrary, you can pick anything you like. |
437 | 441 |
438 You would now have these files under ~/.vim: | 442 You would now have these files under ~/.vim: |
439 pack/my/README.txt | 443 pack/foo/README.txt |
440 pack/my/ever/always/plugin/always.vim | 444 pack/foo/ever/foobar/plugin/foo.vim |
441 pack/my/ever/always/syntax/always.vim | 445 pack/foo/ever/foobar/syntax/some.vim |
442 pack/my/opt/mydebug/plugin/debugger.vim | 446 pack/foo/opt/foodebug/plugin/debugger.vim |
447 | |
448 When Vim starts up, after processing your .vimrc, it scans all directories in | |
449 'packpath' for plugins under the "pack/*/ever" directory and loads them. The | |
450 directory is added to 'runtimepath'. | |
451 | |
452 In the example Vim will find "pack/foo/ever/foobar/plugin/foo.vim" and adds | |
453 "~/.vim/pack/foo/ever/foobar" to 'runtimepath'. | |
454 | |
455 If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will | |
456 find the syntax/some.vim file, because its directory is in 'runtimepath'. | |
457 | |
458 Vim will also load ftdetect files, if there are any. | |
459 | |
460 Note that the files under "pack/foo/opt" or not loaded automatically, only the | |
461 ones under "pack/foo/ever". See |pack-add| below for how the "opt" directory | |
462 is used. | |
463 | |
464 Loading packages will not happen if loading plugins is disabled, see | |
465 |load-plugins|. | |
466 | |
467 | |
468 Using a single plugin and loading it automatically ~ | |
443 | 469 |
444 If you don't have a package but a single plugin, you need to create the extra | 470 If you don't have a package but a single plugin, you need to create the extra |
445 directory level: | 471 directory level: |
446 % mkdir -p ~/.vim/pack/my/ever/always | 472 % mkdir -p ~/.vim/pack/foo/ever/foobar |
447 % cd ~/.vim/pack/my/ever/always | 473 % cd ~/.vim/pack/foo/ever/foobar |
448 % unzip /tmp/myplugin.zip | 474 % unzip /tmp/someplugin.zip |
449 | 475 |
450 When Vim starts up it scans all directories in 'packpath' for plugins under the | 476 You would now have these files: |
451 "ever" directory and loads them. When found that directory is added to | 477 pack/foo/ever/foobar/plugin/foo.vim |
452 'runtimepath'. | 478 pack/foo/ever/foobar/syntax/some.vim |
453 | 479 |
454 In the example Vim will find "my/ever/always/plugin/always.vim" and adds | 480 From here it works like above. |
455 "~/.vim/pack/my/ever/always" to 'runtimepath'. | 481 |
456 | 482 |
457 If the "always" plugin kicks in and sets the 'filetype' to "always", Vim will | 483 Optional plugins ~ |
458 find the syntax/always.vim file, because its directory is in 'runtimepath'. | |
459 | |
460 Vim will also load ftdetect files, like with |:packadd|. | |
461 | |
462 *pack-add* | 484 *pack-add* |
463 To load an optional plugin from a pack use the `:packadd` command: > | 485 To load an optional plugin from a pack use the `:packadd` command: > |
464 :packadd mydebug | 486 :packadd foodebug |
465 This could be done inside always.vim, if some conditions are met. | 487 This searches for "pack/*/opt/foodebug" in 'packpath' and will find |
466 Or you could add this command to your |.vimrc|. | 488 ~/.vim/pack/foo/opt/foodebug/plugin/debugger.vim and source it. |
489 | |
490 This could be done inside always.vim, if some conditions are met. Or you | |
491 could add this command to your |.vimrc|. | |
467 | 492 |
468 It is perfectly normal for a package to only have files in the "opt" | 493 It is perfectly normal for a package to only have files in the "opt" |
469 directory. You then need to load each plugin when you want to use it. | 494 directory. You then need to load each plugin when you want to use it. |
470 | |
471 Loading packages will not happen if loading plugins is disabled, see | |
472 |load-plugins|. | |
473 | 495 |
474 ============================================================================== | 496 ============================================================================== |
475 6. Debugging scripts *debug-scripts* | 497 6. Debugging scripts *debug-scripts* |
476 | 498 |
477 Besides the obvious messages that you can add to your scripts to find out what | 499 Besides the obvious messages that you can add to your scripts to find out what |