diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-07 22:59:26 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-07 22:59:26 +0100 |
commit | 5f148ec0b5a6cedd9129b3abac351034b83cc4f7 (patch) | |
tree | 6c8cd33010252ad1b9dad2ee1a95ab4571ab1ee4 /runtime/doc/repeat.txt | |
parent | 304563c0b3e24895322ce3a29378388665b4769b (diff) |
Update runtime files.
Diffstat (limited to 'runtime/doc/repeat.txt')
-rw-r--r-- | runtime/doc/repeat.txt | 82 |
1 files changed, 52 insertions, 30 deletions
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 1b9e54fcb3..30be59cf49 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 04 +*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -420,57 +420,79 @@ Rationale: A Vim package is a directory that contains one or more plugins. The advantages over normal plugins: - A package can be downloaded as an archive and unpacked in its own directory. - That makes it easy to updated and/or remove. + Thus the files are not mixed with files of other plugins. That makes it + easy to update and remove. - A package can be a git, mercurial, etc. repository. That makes it really easy to update. - A package can contain multiple plugins that depend on each other. - A package can contain plugins that are automatically loaded on startup and - ones that are only loaded when needed with `:loadplugin`. + ones that are only loaded when needed with `:packadd`. + + +Using a package and loading automatically ~ Let's assume your Vim files are in the "~/.vim" directory and you want to add a -package from a zip archive "/tmp/mypack.zip": - % mkdir -p ~/.vim/pack/my - % cd ~/.vim/pack/my - % unzip /tmp/mypack.zip +package from a zip archive "/tmp/foopack.zip": + % mkdir -p ~/.vim/pack/foo + % cd ~/.vim/pack/foo + % unzip /tmp/foopack.zip -The directory name "my" is arbitrary, you can pick anything you like. +The directory name "foo" is arbitrary, you can pick anything you like. You would now have these files under ~/.vim: - pack/my/README.txt - pack/my/ever/always/plugin/always.vim - pack/my/ever/always/syntax/always.vim - pack/my/opt/mydebug/plugin/debugger.vim + pack/foo/README.txt + pack/foo/ever/foobar/plugin/foo.vim + pack/foo/ever/foobar/syntax/some.vim + pack/foo/opt/foodebug/plugin/debugger.vim + +When Vim starts up, after processing your .vimrc, it scans all directories in +'packpath' for plugins under the "pack/*/ever" directory and loads them. The +directory is added to 'runtimepath'. + +In the example Vim will find "pack/foo/ever/foobar/plugin/foo.vim" and adds +"~/.vim/pack/foo/ever/foobar" to 'runtimepath'. + +If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will +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 +ones under "pack/foo/ever". See |pack-add| below for how the "opt" directory +is used. + +Loading packages will not happen if loading plugins is disabled, see +|load-plugins|. + + +Using a single plugin and loading it automatically ~ If you don't have a package but a single plugin, you need to create the extra directory level: - % mkdir -p ~/.vim/pack/my/ever/always - % cd ~/.vim/pack/my/ever/always - % unzip /tmp/myplugin.zip - -When Vim starts up it scans all directories in 'packpath' for plugins under the -"ever" directory and loads them. When found that directory is added to -'runtimepath'. + % mkdir -p ~/.vim/pack/foo/ever/foobar + % cd ~/.vim/pack/foo/ever/foobar + % unzip /tmp/someplugin.zip -In the example Vim will find "my/ever/always/plugin/always.vim" and adds -"~/.vim/pack/my/ever/always" to 'runtimepath'. +You would now have these files: + pack/foo/ever/foobar/plugin/foo.vim + pack/foo/ever/foobar/syntax/some.vim -If the "always" plugin kicks in and sets the 'filetype' to "always", Vim will -find the syntax/always.vim file, because its directory is in 'runtimepath'. +From here it works like above. -Vim will also load ftdetect files, like with |:packadd|. +Optional plugins ~ *pack-add* To load an optional plugin from a pack use the `:packadd` command: > - :packadd mydebug -This could be done inside always.vim, if some conditions are met. -Or you could add this command to your |.vimrc|. + :packadd foodebug +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|. 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. -Loading packages will not happen if loading plugins is disabled, see -|load-plugins|. - ============================================================================== 6. Debugging scripts *debug-scripts* |