Skip to content

Commit f6fee0e

Browse files
committed
patch 7.4.1384
Problem: It is not easy to use a set of plugins and their dependencies. Solution: Add packages, ":loadopt", 'packpath'.
1 parent 271273c commit f6fee0e

File tree

13 files changed

+245
-42
lines changed

13 files changed

+245
-42
lines changed

runtime/doc/options.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 7.4. Last change: 2016 Feb 20
1+
*options.txt* For Vim version 7.4. Last change: 2016 Feb 21
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5409,6 +5409,13 @@ A jump table for the options with a short description can be found at |Q_op|.
54095409
This option was supported on RISC OS, which has been removed.
54105410

54115411

5412+
*'packpath'* *'pp'*
5413+
'packpath' 'pp' string (default: see 'runtimepath')
5414+
{not in Vi}
5415+
{not available without the |+packages| feature}
5416+
Directories used to find packages. See |packages|.
5417+
5418+
54125419
*'paragraphs'* *'para'*
54135420
'paragraphs' 'para' string (default "IPLPPPQPP TPHPLIPpLpItpplpipbp")
54145421
global

runtime/doc/repeat.txt

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 12
1+
*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 21
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -12,8 +12,9 @@ Chapter 26 of the user manual introduces repeating |usr_26.txt|.
1212
2. Multiple repeats |multi-repeat|
1313
3. Complex repeats |complex-repeat|
1414
4. Using Vim scripts |using-scripts|
15-
5. Debugging scripts |debug-scripts|
16-
6. Profiling |profiling|
15+
5. Using Vim packages |packages|
16+
6. Debugging scripts |debug-scripts|
17+
7. Profiling |profiling|
1718

1819
==============================================================================
1920
1. Single repeats *single-repeat*
@@ -212,6 +213,22 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
212213
about each searched file.
213214
{not in Vi}
214215

216+
*:loadp* *:loadplugin*
217+
:loadp[lugin] {name} Search for an optional plugin directory and source the
218+
plugin files found. It is similar to: >
219+
:runtime pack/*/opt/{name}/plugin/*.vim
220+
< However, `:loadplugin` uses 'packpath' instead of
221+
'runtimepath'. And the directory found is added to
222+
'runtimepath'.
223+
224+
Note that {name} is the directory name, not the name
225+
of the .vim file. If the "{name}/plugin" directory
226+
contains more than one file they are all sourced.
227+
228+
Also see |load-plugin|.
229+
230+
{not available without the |+packages| feature}
231+
215232
:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167*
216233
Specify the character encoding used in the script.
217234
The following lines will be converted from [encoding]
@@ -388,7 +405,56 @@ Rationale:
388405
< Therefore the unusual leading backslash is used.
389406

390407
==============================================================================
391-
5. Debugging scripts *debug-scripts*
408+
5. Using Vim packages *packages*
409+
410+
A Vim package is a directory that contains one or more plugins. The
411+
advantages over normal plugins:
412+
- A package can be downloaded as an archive and unpacked in its own directory.
413+
That makes it easy to updated and/or remove.
414+
- A package can be a git, mercurial, etc. respository. That makes it really
415+
easy to update.
416+
- A package can contain multiple plugins that depend on each other.
417+
- A package can contain plugins that are automatically loaded on startup and
418+
ones that are only loaded when needed with `:loadplugin`.
419+
420+
Let's assume your Vim files are in the "~/.vim" directory and you want to add a
421+
package from a zip archive "/tmp/mypack.zip":
422+
% mkdir -p ~/.vim/pack/my
423+
% cd ~/.vim/pack/my
424+
% unzip /tmp/mypack.zip
425+
426+
The directory name "my" is arbitrary, you can pick anything you like.
427+
428+
You would now have these files under ~/.vim:
429+
pack/my/README.txt
430+
pack/my/ever/always/plugin/always.vim
431+
pack/my/ever/always/syntax/always.vim
432+
pack/my/opt/mydebug/plugin/debugger.vim
433+
434+
When Vim starts up it scans all directories in 'packpath' for plugins under the
435+
"ever" directory and loads them. When found that directory is added to
436+
'runtimepath'.
437+
438+
In the example Vim will find "my/ever/always/plugin/always.vim" and adds
439+
"~/.vim/pack/my/ever/always" to 'runtimepath'.
440+
441+
If the "always" plugin kicks in and sets the 'filetype' to "always", Vim will
442+
find the syntax/always.vim file, because its directory is in 'runtimepath'.
443+
444+
*load-plugin*
445+
To load an optional plugin from a pack use the `:loadplugin` command: >
446+
:loadplugin mydebug
447+
This could be done inside always.vim, if some conditions are met.
448+
Or you could add this command to your |.vimrc|.
449+
450+
It is perfectly normal for a package to only have files in the "opt"
451+
directory. You then need to load each plugin when you want to use it.
452+
453+
Loading packages will not happen if loading plugins is disabled, see
454+
|load-plugins|.
455+
456+
==============================================================================
457+
6. Debugging scripts *debug-scripts*
392458

393459
Besides the obvious messages that you can add to your scripts to find out what
394460
they are doing, Vim offers a debug mode. This allows you to step through a
@@ -613,7 +679,7 @@ OBSCURE
613679
user, don't use typeahead for debug commands.
614680

615681
==============================================================================
616-
6. Profiling *profile* *profiling*
682+
7. Profiling *profile* *profiling*
617683

618684
Profiling means that Vim measures the time that is spent on executing
619685
functions and/or scripts. The |+profile| feature is required for this.

runtime/doc/starting.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*starting.txt* For Vim version 7.4. Last change: 2016 Feb 18
1+
*starting.txt* For Vim version 7.4. Last change: 2016 Feb 21
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -857,6 +857,10 @@ accordingly. Vim proceeds in this order:
857857
commands from the command line have not been executed yet. You can
858858
use "--cmd 'set noloadplugins'" |--cmd|.
859859

860+
Plugin packs are loaded. These are plugins, as above, but found in
861+
'packpath' directories. Every plugin directory found is added in
862+
'runtimepath'. See |packages|.
863+
860864
5. Set 'shellpipe' and 'shellredir'
861865
The 'shellpipe' and 'shellredir' options are set according to the
862866
value of the 'shell' option, unless they have been set before.

runtime/doc/tags

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
726726
'option' intro.txt /*'option'*
727727
'osfiletype' options.txt /*'osfiletype'*
728728
'pa' options.txt /*'pa'*
729+
'packpath' options.txt /*'packpath'*
729730
'para' options.txt /*'para'*
730731
'paragraphs' options.txt /*'paragraphs'*
731732
'paste' options.txt /*'paste'*
@@ -746,6 +747,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
746747
'pmbcs' options.txt /*'pmbcs'*
747748
'pmbfn' options.txt /*'pmbfn'*
748749
'popt' options.txt /*'popt'*
750+
'pp' options.txt /*'pp'*
749751
'preserveindent' options.txt /*'preserveindent'*
750752
'previewheight' options.txt /*'previewheight'*
751753
'previewwindow' options.txt /*'previewwindow'*
@@ -3540,6 +3542,7 @@ CTRL-\_CTRL-N intro.txt /*CTRL-\\_CTRL-N*
35403542
CTRL-] tagsrch.txt /*CTRL-]*
35413543
CTRL-^ editing.txt /*CTRL-^*
35423544
CTRL-{char} intro.txt /*CTRL-{char}*
3545+
Channel eval.txt /*Channel*
35433546
Chinese mbyte.txt /*Chinese*
35443547
Cmd-event autocmd.txt /*Cmd-event*
35453548
CmdUndefined autocmd.txt /*CmdUndefined*
@@ -4427,7 +4430,6 @@ E893 eval.txt /*E893*
44274430
E894 eval.txt /*E894*
44284431
E895 if_mzsch.txt /*E895*
44294432
E896 channel.txt /*E896*
4430-
E897 channel.txt /*E897*
44314433
E898 channel.txt /*E898*
44324434
E899 channel.txt /*E899*
44334435
E90 message.txt /*E90*
@@ -4447,6 +4449,8 @@ E911 eval.txt /*E911*
44474449
E912 eval.txt /*E912*
44484450
E913 eval.txt /*E913*
44494451
E914 eval.txt /*E914*
4452+
E915 channel.txt /*E915*
4453+
E916 eval.txt /*E916*
44504454
E92 message.txt /*E92*
44514455
E93 windows.txt /*E93*
44524456
E94 windows.txt /*E94*
@@ -4515,6 +4519,7 @@ InsertEnter autocmd.txt /*InsertEnter*
45154519
InsertLeave autocmd.txt /*InsertLeave*
45164520
J change.txt /*J*
45174521
Japanese mbyte.txt /*Japanese*
4522+
Job eval.txt /*Job*
45184523
K various.txt /*K*
45194524
KDE gui_x11.txt /*KDE*
45204525
KVim gui_x11.txt /*KVim*
@@ -4659,6 +4664,7 @@ ShellCmdPost autocmd.txt /*ShellCmdPost*
46594664
ShellFilterPost autocmd.txt /*ShellFilterPost*
46604665
SourceCmd autocmd.txt /*SourceCmd*
46614666
SourcePre autocmd.txt /*SourcePre*
4667+
Special eval.txt /*Special*
46624668
SpellFileMissing autocmd.txt /*SpellFileMissing*
46634669
StdinReadPost autocmd.txt /*StdinReadPost*
46644670
StdinReadPre autocmd.txt /*StdinReadPre*
@@ -5168,9 +5174,11 @@ cc change.txt /*cc*
51685174
ceil() eval.txt /*ceil()*
51695175
ch.vim syntax.txt /*ch.vim*
51705176
ch_close() eval.txt /*ch_close()*
5177+
ch_getjob() eval.txt /*ch_getjob()*
51715178
ch_log() eval.txt /*ch_log()*
51725179
ch_logfile() eval.txt /*ch_logfile()*
51735180
ch_open() eval.txt /*ch_open()*
5181+
ch_read() eval.txt /*ch_read()*
51745182
ch_readraw() eval.txt /*ch_readraw()*
51755183
ch_sendexpr() eval.txt /*ch_sendexpr()*
51765184
ch_sendraw() eval.txt /*ch_sendraw()*
@@ -5203,6 +5211,7 @@ changetick eval.txt /*changetick*
52035211
changing change.txt /*changing*
52045212
channel channel.txt /*channel*
52055213
channel-callback channel.txt /*channel-callback*
5214+
channel-close channel.txt /*channel-close*
52065215
channel-commands channel.txt /*channel-commands*
52075216
channel-demo channel.txt /*channel-demo*
52085217
channel-mode channel.txt /*channel-mode*
@@ -5273,6 +5282,7 @@ clipboard-html options.txt /*clipboard-html*
52735282
clipboard-unnamed options.txt /*clipboard-unnamed*
52745283
clipboard-unnamedplus options.txt /*clipboard-unnamedplus*
52755284
clojure-indent indent.txt /*clojure-indent*
5285+
close-cb channel.txt /*close-cb*
52765286
cmdarg-variable eval.txt /*cmdarg-variable*
52775287
cmdbang-variable eval.txt /*cmdbang-variable*
52785288
cmdline-arguments vi_diff.txt /*cmdline-arguments*
@@ -5639,6 +5649,8 @@ end intro.txt /*end*
56395649
end-of-file pattern.txt /*end-of-file*
56405650
enlightened-terminal syntax.txt /*enlightened-terminal*
56415651
erlang.vim syntax.txt /*erlang.vim*
5652+
err-cb channel.txt /*err-cb*
5653+
err-timeout channel.txt /*err-timeout*
56425654
errmsg-variable eval.txt /*errmsg-variable*
56435655
error-file-format quickfix.txt /*error-file-format*
56445656
error-messages message.txt /*error-messages*
@@ -6433,7 +6445,6 @@ gui-shell-win32 gui_w32.txt /*gui-shell-win32*
64336445
gui-start gui.txt /*gui-start*
64346446
gui-toolbar gui.txt /*gui-toolbar*
64356447
gui-vert-scroll gui.txt /*gui-vert-scroll*
6436-
gui-w16 gui_w16.txt /*gui-w16*
64376448
gui-w32 gui_w32.txt /*gui-w32*
64386449
gui-w32-cmdargs gui_w32.txt /*gui-w32-cmdargs*
64396450
gui-w32-dialogs gui_w32.txt /*gui-w32-dialogs*
@@ -6455,7 +6466,6 @@ gui-x11-printing gui_x11.txt /*gui-x11-printing*
64556466
gui-x11-start gui_x11.txt /*gui-x11-start*
64566467
gui-x11-various gui_x11.txt /*gui-x11-various*
64576468
gui.txt gui.txt /*gui.txt*
6458-
gui_w16.txt gui_w16.txt /*gui_w16.txt*
64596469
gui_w32.txt gui_w32.txt /*gui_w32.txt*
64606470
gui_x11.txt gui_x11.txt /*gui_x11.txt*
64616471
guifontwide_gtk2 options.txt /*guifontwide_gtk2*
@@ -6832,22 +6842,24 @@ java.vim syntax.txt /*java.vim*
68326842
javascript-cinoptions indent.txt /*javascript-cinoptions*
68336843
javascript-indenting indent.txt /*javascript-indenting*
68346844
job channel.txt /*job*
6845+
job-callback channel.txt /*job-callback*
68356846
job-channel-overview channel.txt /*job-channel-overview*
68366847
job-close-cb channel.txt /*job-close-cb*
68376848
job-control channel.txt /*job-control*
68386849
job-err-cb channel.txt /*job-err-cb*
68396850
job-err-io channel.txt /*job-err-io*
68406851
job-exit-cb channel.txt /*job-exit-cb*
68416852
job-in-io channel.txt /*job-in-io*
6842-
job-killonexit channel.txt /*job-killonexit*
68436853
job-may-start channel.txt /*job-may-start*
68446854
job-options channel.txt /*job-options*
68456855
job-out-cb channel.txt /*job-out-cb*
68466856
job-out-io channel.txt /*job-out-io*
68476857
job-start channel.txt /*job-start*
68486858
job-start-nochannel channel.txt /*job-start-nochannel*
6859+
job-stoponexit channel.txt /*job-stoponexit*
68496860
job-term channel.txt /*job-term*
68506861
job_getchannel() eval.txt /*job_getchannel()*
6862+
job_setoptions() eval.txt /*job_setoptions()*
68516863
job_start() eval.txt /*job_start()*
68526864
job_status() eval.txt /*job_status()*
68536865
job_stop() eval.txt /*job_stop()*
@@ -7577,7 +7589,10 @@ os_unix.txt os_unix.txt /*os_unix.txt*
75777589
os_vms.txt os_vms.txt /*os_vms.txt*
75787590
os_win32.txt os_win32.txt /*os_win32.txt*
75797591
other-features vi_diff.txt /*other-features*
7592+
out-cb channel.txt /*out-cb*
7593+
out-timeout channel.txt /*out-timeout*
75807594
p change.txt /*p*
7595+
packages repeat.txt /*packages*
75817596
page-down intro.txt /*page-down*
75827597
page-up intro.txt /*page-up*
75837598
page_down intro.txt /*page_down*
@@ -8995,25 +9010,13 @@ w: eval.txt /*w:*
89959010
w:current_syntax syntax.txt /*w:current_syntax*
89969011
w:quickfix_title quickfix.txt /*w:quickfix_title*
89979012
w:var eval.txt /*w:var*
9013+
waittime channel.txt /*waittime*
89989014
warningmsg-variable eval.txt /*warningmsg-variable*
89999015
white-space pattern.txt /*white-space*
90009016
whitespace pattern.txt /*whitespace*
90019017
wildcard editing.txt /*wildcard*
90029018
wildcards editing.txt /*wildcards*
90039019
wildmenumode() eval.txt /*wildmenumode()*
9004-
win16-!start gui_w16.txt /*win16-!start*
9005-
win16-clipboard gui_w16.txt /*win16-clipboard*
9006-
win16-colors gui_w16.txt /*win16-colors*
9007-
win16-default-editor gui_w16.txt /*win16-default-editor*
9008-
win16-dialogs gui_w16.txt /*win16-dialogs*
9009-
win16-drag-n-drop gui_w16.txt /*win16-drag-n-drop*
9010-
win16-gui gui_w16.txt /*win16-gui*
9011-
win16-maximized gui_w16.txt /*win16-maximized*
9012-
win16-printing gui_w16.txt /*win16-printing*
9013-
win16-shell gui_w16.txt /*win16-shell*
9014-
win16-start gui_w16.txt /*win16-start*
9015-
win16-truetype gui_w16.txt /*win16-truetype*
9016-
win16-various gui_w16.txt /*win16-various*
90179020
win32 os_win32.txt /*win32*
90189021
win32-!start gui_w32.txt /*win32-!start*
90199022
win32-PATH os_win32.txt /*win32-PATH*

runtime/optwin.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" These commands create the option window.
22
"
33
" Maintainer: Bram Moolenaar <[email protected]>
4-
" Last Change: 2015 Nov 10
4+
" Last Change: 2016 Feb 21
55

66
" If there already is an option window, jump to that one.
77
if bufwinnr("option-window") > 0
@@ -228,6 +228,8 @@ else
228228
endif
229229
call append("$", "runtimepath\tlist of directories used for runtime files and plugins")
230230
call <SID>OptionG("rtp", &rtp)
231+
call append("$", "packpath\tlist of directories used for plugin packages")
232+
call <SID>OptionG("pp", &pp)
231233
call append("$", "helpfile\tname of the main help file")
232234
call <SID>OptionG("hf", &hf)
233235

src/eval.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13785,6 +13785,7 @@ f_has(typval_T *argvars, typval_T *rettv)
1378513785
#ifdef FEAT_OLE
1378613786
"ole",
1378713787
#endif
13788+
"packages",
1378813789
#ifdef FEAT_PATH_EXTRA
1378913790
"path_extra",
1379013791
#endif

src/ex_cmds.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,9 @@ EX(CMD_loadview, "loadview", ex_loadview,
810810
EX(CMD_loadkeymap, "loadkeymap", ex_loadkeymap,
811811
CMDWIN,
812812
ADDR_LINES),
813+
EX(CMD_loadplugin, "loadplugin", ex_loadplugin,
814+
BANG|FILE1|TRLBAR|SBOXOK|CMDWIN,
815+
ADDR_LINES),
813816
EX(CMD_lockmarks, "lockmarks", ex_wrongmodifier,
814817
NEEDARG|EXTRA|NOTRLCOM,
815818
ADDR_LINES),

0 commit comments

Comments
 (0)