diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-26 23:01:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-26 23:01:59 +0100 |
commit | 4f3f668c8486444e53163c29d2fc79bf47eb3c82 (patch) | |
tree | 08713fc52cdeb5172be5eed09be1bd9910d81700 /runtime/doc/repeat.txt | |
parent | c4dcd60c76666bf113719f929709ad6120eb6528 (diff) |
Updated runtime files.
Diffstat (limited to 'runtime/doc/repeat.txt')
-rw-r--r-- | runtime/doc/repeat.txt | 103 |
1 files changed, 90 insertions, 13 deletions
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index c8624a2666..df94a74128 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 15 +*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -8,13 +8,14 @@ Repeating commands, Vim scripts and debugging *repeating* Chapter 26 of the user manual introduces repeating |usr_26.txt|. -1. Single repeats |single-repeat| -2. Multiple repeats |multi-repeat| -3. Complex repeats |complex-repeat| -4. Using Vim scripts |using-scripts| -5. Using Vim packages |packages| -6. Debugging scripts |debug-scripts| -7. Profiling |profiling| +1. Single repeats |single-repeat| +2. Multiple repeats |multi-repeat| +3. Complex repeats |complex-repeat| +4. Using Vim scripts |using-scripts| +5. Using Vim packages |packages| +6. Creating Vim packages |package-create| +7. Debugging scripts |debug-scripts| +8. Profiling |profiling| ============================================================================== 1. Single repeats *single-repeat* @@ -481,7 +482,7 @@ find the syntax/some.vim file, because its directory is in 'runtimepath'. Vim will also load ftdetect files, if there are any. -Note that the files under "pack/foo/opt" or not loaded automatically, only the +Note that the files under "pack/foo/opt" are not loaded automatically, only the ones under "pack/foo/start". See |pack-add| below for how the "opt" directory is used. @@ -516,14 +517,90 @@ To load an optional plugin from a pack use the `:packadd` command: > This searches for "pack/*/opt/foodebug" in 'packpath' and will find ~/.vim/pack/foo/opt/foodebug/plugin/debugger.vim and source it. -This could be done inside always.vim, if some conditions are met. Or you -could add this command to your |.vimrc|. +This could be done if some conditions are met. For example, depending on +whether Vim supports a feature or a dependency is missing. + +You can also load an optional plugin at startup, by putting this command in +your |.vimrc|: > + :packadd! foodebug +The extra "!" is so that the plugin isn't loaded with Vim was started with +|--noplugin|. It is perfectly normal for a package to only have files in the "opt" directory. You then need to load each plugin when you want to use it. + +Where to put what ~ + +Since color schemes, loaded with `:colorscheme`, are found below +"pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend +you put them below "pack/*/opt", for example +".vim/pack/mycolors/opt/dark/colors/very_dark.vim". + +Filetype plugins should go under "pack/*/start", so that they are always +found. Unless you have more than one plugin for a file type and want to +select which one to load with `:packadd`. E.g. depending on the compiler +version: > + if foo_compiler_version > 34 + packadd foo_new + else + packadd foo_old + endif + +The "after" directory is most likely not useful in a package. It's not +disallowed though. + +============================================================================== +6. Creating Vim packages *package-create* + +This assumes you write one or more plugins that you distribute as a package. + +If you have two unrelated plugins you would use two packages, so that Vim +users can chose what they include or not. Or you can decide to use one +package with optional plugins, and tell the user to add the ones he wants with +`:packadd`. + +Decide how you want to distribute the package. You can create an archive or +you could use a repository. An archive can be used by more users, but is a +bit harder to update to a new version. A repository can usually be kept +up-to-date easily, but it requires a program like "git" to be available. +You can do both, github can automatically create an archive for a release. + +Your directory layout would be like this: + start/foobar/plugin/foo.vim " always loaded, defines commands + start/foobar/plugin/bar.vim " always loaded, defines commands + start/foobar/autoload/foo.vim " loaded when foo command used + start/foobar/doc/foo.txt " help for foo.vim + start/foobar/doc/tags " help tags + opt/fooextra/plugin/extra.vim " optional plugin, defines commands + opt/fooextra/autoload/extra.vim " loaded when extra command used + opt/fooextra/doc/extra.txt " help for extra.vim + opt/fooextra/doc/tags " help tags + +This allows for the user to do: > + mkdir ~/.vim/pack/myfoobar + cd ~/.vim/pack/myfoobar + git clone https://github.com/you/foobar.git + +Here "myfoobar" is a name that the user can choose, the only condition is that +it differs from other packages. + +In your documentation you explain what the plugins do, and tell the user how +to load the optional plugin: > + :packadd! fooextra + +You could add this packadd command in one of your plugins, to be executed when +the optional plugin is needed. + +Run the `:helptags` command to generate the doc/tags file. Including this +generated file in the package means that the user can drop the package in his +pack directory and the help command works right away. Don't forget to re-run +the command after changing the plugin help: > + :helptags path/start/foobar/doc + :helptags path/opt/fooextra/doc + ============================================================================== -6. Debugging scripts *debug-scripts* +7. Debugging scripts *debug-scripts* Besides the obvious messages that you can add to your scripts to find out what they are doing, Vim offers a debug mode. This allows you to step through a @@ -748,7 +825,7 @@ OBSCURE user, don't use typeahead for debug commands. ============================================================================== -7. Profiling *profile* *profiling* +8. Profiling *profile* *profiling* Profiling means that Vim measures the time that is spent on executing functions and/or scripts. The |+profile| feature is required for this. |