Skip to content

Commit 914e85a

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 3930415 + 2369c15 commit 914e85a

18 files changed

Lines changed: 537 additions & 275 deletions

runtime/doc/channel.txt

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*channel.txt* For Vim version 7.4. Last change: 2016 Feb 27
1+
*channel.txt* For Vim version 7.4. Last change: 2016 Mar 03
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -103,6 +103,11 @@ when opening the channel: >
103103
let channel = ch_open('localhost:8765', {'callback': "MyHandler"})
104104
call ch_sendexpr(channel, 'hello!')
105105
106+
When trying out channels it's useful to see what is going on. You can tell
107+
Vim to write lines in log file: >
108+
call ch_logfile('channellog', 'w')
109+
See |ch_logfile()|.
110+
106111
==============================================================================
107112
3. Opening a channel *channel-open*
108113

@@ -130,7 +135,8 @@ Use |ch_status()| to see if the channel could be opened.
130135
overwritten. Therefore set "mode" first and the part specific
131136
mode later.
132137

133-
Note: when writing to a file or buffer NL mode is always used.
138+
Note: when writing to a file or buffer and when reading from a
139+
buffer NL mode is used by default.
134140

135141
*channel-callback*
136142
"callback" A function that is called when a message is received that is
@@ -191,6 +197,10 @@ For example, the handler can be added or changed: >
191197
call ch_setoptions(channel, {'callback': callback})
192198
When "callback" is empty (zero or an empty string) the handler is removed.
193199

200+
After a callback has been invoked Vim will update the screen and put the
201+
cursor back where it belongs. Thus the callback should not need to do
202+
`:redraw`.
203+
194204
The timeout can be changed: >
195205
call ch_setoptions(channel, {'timeout': msec})
196206
<
@@ -259,9 +269,9 @@ message, it must use the number zero:
259269
Then channel handler will then get {response} converted to Vim types. If the
260270
channel does not have a handler the message is dropped.
261271

262-
On read error or ch_close(), when using a socket, the string "DETACH" is sent,
263-
if still possible. The channel will then be inactive. For a JSON and JS mode
264-
channel quotes are used around DETACH, otherwise there are no quotes.
272+
On read error or ch_close(), when using a socket with RAW or NL mode, the
273+
string "DETACH\n" is sent, if still possible. The channel will then be
274+
inactive.
265275

266276
It is also possible to use ch_sendraw() and ch_evalraw() on a JSON or JS
267277
channel. The caller is then completely responsible for correct encoding and
@@ -457,6 +467,22 @@ For example, to start a job and write its output in buffer "dummy": >
457467
\ {'out-io': 'buffer', 'out-name': 'dummy'})
458468
sbuf dummy
459469
470+
To run a job that reads from a buffer: >
471+
let job = job_start({command},
472+
\ {'in-io': 'buffer', 'in-name': 'mybuffer'})
473+
<
474+
*E915* *E918*
475+
The buffer is found by name, similar to |bufnr()|. The buffer must exist and
476+
be loaded when job_start() is called.
477+
478+
By default this reads the whole buffer. This can be changed with the "in-top"
479+
and "in-bot" options.
480+
481+
TODO
482+
A special mode is when "in-top" is set to zero and "in-bot" is not set: The
483+
last-but-one line will be send to the job stdin. This allows for editing the
484+
last line and sending it when pressing Enter.
485+
460486
TODO:
461487
To run a job and read its output once it is done: >
462488
let job = job_start({command}, {'exit-cb': 'MyHandler'})
@@ -470,7 +496,8 @@ To run a job and read its output once it is done: >
470496
9. Starting a job without a channel *job-start-nochannel*
471497

472498
To start another process without creating a channel: >
473-
let job = job_start(command, {"in-io": "null", "out-io": "null"})
499+
let job = job_start(command,
500+
\ {"in-io": "null", "out-io": "null", "err-io": "null"})
474501
475502
This starts {command} in the background, Vim does not wait for it to finish.
476503

@@ -538,7 +565,9 @@ TODO: *job-term*
538565
"in-io": "null" disconnect stdin TODO
539566
"in-io": "pipe" stdin is connected to the channel (default)
540567
"in-io": "file" stdin reads from a file TODO
541-
"in-io": "buffer" stdin reads from a buffer TODO
568+
"in-io": "buffer" stdin reads from a buffer
569+
"in-top": number when using "buffer": first line to send (default: 1)
570+
"in-bot": number when using "buffer": last line to send (default: last)
542571
"in-name": "/path/file" the name of he file or buffer to read from
543572
"in-buf": number the number of the buffer to read from TODO
544573

@@ -551,7 +580,7 @@ TODO: *job-term*
551580
"out-buf": number the number of the buffer to write to TODO
552581

553582
*job-err-io*
554-
"err-io": "out" same as stdout TODO
583+
"err-io": "out" stderr messages to go to stdout
555584
"err-io": "null" disconnect stderr TODO
556585
"err-io": "pipe" stderr is connected to the channel (default)
557586
"err-io": "file" stderr writes to a file TODO
@@ -562,6 +591,10 @@ TODO: *job-term*
562591
When the IO mode is "buffer" and there is a callback, the text is appended to
563592
the buffer before invoking the callback.
564593

594+
When using JS or JSON mode with "buffer", only messages with zero or negative
595+
ID will be added to the buffer, after decoding + encoding. Messages with a
596+
positive number will be handled by a callback, commands are handled as usual.
597+
565598
The name of the buffer is compared the full name of existing buffers. If
566599
there is a match that buffer is used. Otherwise a new buffer is created.
567600
Use an empty name to always create a new buffer. |ch_getbufnr()| can then be

runtime/doc/eval.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 27
1+
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 03
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2695,6 +2695,14 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
26952695

26962696
ch_close({channel}) *ch_close()*
26972697
Close {channel}. See |channel-close|.
2698+
2699+
Note that a channel is closed in three stages:
2700+
- The I/O ends, log message: "Closing channel". There can
2701+
still be queued messages to read or callbacks to invoke.
2702+
- The readahead is cleared, log message: "Clearing channel".
2703+
Some variables may still reference the channel.
2704+
- The channel is freed, log message: "Freeing channel".
2705+
26982706
{only available when compiled with the |+channel| feature}
26992707

27002708
ch_evalexpr({channel}, {expr} [, {options}]) *ch_evalexpr()*
@@ -2703,7 +2711,7 @@ ch_evalexpr({channel}, {expr} [, {options}]) *ch_evalexpr()*
27032711
with a raw channel. See |channel-use|.
27042712
*E917*
27052713
{options} must be a Dictionary. It must not have a "callback"
2706-
entry.
2714+
entry. It can have a "timeout" entry.
27072715

27082716
ch_evalexpr() waits for a response and returns the decoded
27092717
expression. When there is an error or timeout it returns an
@@ -2753,6 +2761,7 @@ ch_logfile({fname} [, {mode}]) *ch_logfile()*
27532761
The file is flushed after every message, on Unix you can use
27542762
"tail -f" to see what is going on in real time.
27552763

2764+
27562765
ch_open({address} [, {options}]) *ch_open()*
27572766
Open a channel to {address}. See |channel|.
27582767
Returns a Channel. Use |ch_status()| to check for

runtime/doc/index.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*index.txt* For Vim version 7.4. Last change: 2016 Feb 27
1+
*index.txt* For Vim version 7.4. Last change: 2016 Mar 04
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1324,7 +1324,6 @@ tag command action ~
13241324
|:lnfile| :lnf[ile] go to first location in next file
13251325
|:lnoremap| :ln[oremap] like ":noremap!" but includes Lang-Arg mode
13261326
|:loadkeymap| :loadk[eymap] load the following keymaps until EOF
1327-
|:loadplugin| :loadp[lugin] load a plugin from 'packpath'
13281327
|:loadview| :lo[adview] load view for current window from a file
13291328
|:lockmarks| :loc[kmarks] following command keeps marks where they are
13301329
|:lockvar| :lockv[ar] lock variables
@@ -1397,6 +1396,7 @@ tag command action ~
13971396
|:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode
13981397
|:ounmenu| :ounme[nu] remove menu for Operator-pending mode
13991398
|:ownsyntax| :ow[nsyntax] set new local syntax highlight for this window
1399+
|:packadd| :pa[ckadd] add a plugin from 'packpath'
14001400
|:pclose| :pc[lose] close preview window
14011401
|:pedit| :ped[it] edit file in the preview window
14021402
|:perl| :pe[rl] execute Perl command

runtime/doc/repeat.txt

Lines changed: 31 additions & 17 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 26
1+
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 04
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -213,23 +213,31 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
213213
about each searched file.
214214
{not in Vi}
215215

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-
If you have a directory under 'packpath' that doesn't
225-
actually have a plugin file, just create an empty one.
226-
This will still add the directory to 'runtimepath'.
216+
*:pa* *:packadd*
217+
:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath'
218+
and source any plugin files found. The directory must
219+
match:
220+
pack/*/opt/{name} ~
221+
The directory is added to 'runtimepath' if it wasn't
222+
there yet.
227223

228224
Note that {name} is the directory name, not the name
229225
of the .vim file. If the "{name}/plugin" directory
230226
contains more than one file they are all sourced.
231227

232-
Also see |load-plugin|.
228+
If the filetype detection was not enabled yet (this
229+
is usually done with a "syntax enable" or "filetype
230+
on" command in your .vimrc file), this will also look
231+
for "{name}/ftdetect/*.vim" files.
232+
233+
When the optional ! is added no plugin files or
234+
ftdetect scripts are loaded, only the matching
235+
directories are added to 'runtimepath'. This is
236+
useful in your .vimrc. The plugins will then be
237+
loaded during initialization, see |load-plugins|.
238+
239+
Also see |pack-add|.
240+
233241

234242
:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167*
235243
Specify the character encoding used in the script.
@@ -433,6 +441,12 @@ You would now have these files under ~/.vim:
433441
pack/my/ever/always/syntax/always.vim
434442
pack/my/opt/mydebug/plugin/debugger.vim
435443

444+
If you don't have a package but a single plugin, you need to create the extra
445+
directory level:
446+
% mkdir -p ~/.vim/pack/my/ever/always
447+
% cd ~/.vim/pack/my/ever/always
448+
% unzip /tmp/myplugin.zip
449+
436450
When Vim starts up it scans all directories in 'packpath' for plugins under the
437451
"ever" directory and loads them. When found that directory is added to
438452
'runtimepath'.
@@ -443,11 +457,11 @@ In the example Vim will find "my/ever/always/plugin/always.vim" and adds
443457
If the "always" plugin kicks in and sets the 'filetype' to "always", Vim will
444458
find the syntax/always.vim file, because its directory is in 'runtimepath'.
445459

446-
Vim will also load ftdetect files, like with |:loadplugin|.
460+
Vim will also load ftdetect files, like with |:packadd|.
447461

448-
*load-plugin*
449-
To load an optional plugin from a pack use the `:loadplugin` command: >
450-
:loadplugin mydebug
462+
*pack-add*
463+
To load an optional plugin from a pack use the `:packadd` command: >
464+
:packadd mydebug
451465
This could be done inside always.vim, if some conditions are met.
452466
Or you could add this command to your |.vimrc|.
453467

runtime/doc/starting.txt

Lines changed: 3 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 27
1+
*starting.txt* For Vim version 7.4. Last change: 2016 Mar 03
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -833,6 +833,8 @@ accordingly. Vim proceeds in this order:
833833
- The user exrc file(s). Same as for the user vimrc file, but with
834834
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
835835
used, depending on the system. And without the (*)!
836+
- You would usually have "syntax on" and/or "filetype on" commands,
837+
which trigger initializing filetype detection, see |syntax-loading|.
836838

837839
d. If the 'exrc' option is on (which is not the default), the current
838840
directory is searched for three files. The first that exists is used,

runtime/doc/tags

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,8 +2465,6 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
24652465
:lo starting.txt /*:lo*
24662466
:loadk mbyte.txt /*:loadk*
24672467
:loadkeymap mbyte.txt /*:loadkeymap*
2468-
:loadp repeat.txt /*:loadp*
2469-
:loadplugin repeat.txt /*:loadplugin*
24702468
:loadview starting.txt /*:loadview*
24712469
:loc motion.txt /*:loc*
24722470
:lockmarks motion.txt /*:lockmarks*
@@ -2643,6 +2641,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
26432641
:ounmenu gui.txt /*:ounmenu*
26442642
:ownsyntax syntax.txt /*:ownsyntax*
26452643
:p various.txt /*:p*
2644+
:pa repeat.txt /*:pa*
2645+
:packadd repeat.txt /*:packadd*
26462646
:pc windows.txt /*:pc*
26472647
:pclose windows.txt /*:pclose*
26482648
:pe if_perl.txt /*:pe*
@@ -4487,8 +4487,10 @@ E911 eval.txt /*E911*
44874487
E912 eval.txt /*E912*
44884488
E913 eval.txt /*E913*
44894489
E914 eval.txt /*E914*
4490+
E915 channel.txt /*E915*
44904491
E916 eval.txt /*E916*
44914492
E917 eval.txt /*E917*
4493+
E918 channel.txt /*E918*
44924494
E92 message.txt /*E92*
44934495
E93 windows.txt /*E93*
44944496
E94 windows.txt /*E94*
@@ -7001,7 +7003,6 @@ list-repeat windows.txt /*list-repeat*
70017003
lite.vim syntax.txt /*lite.vim*
70027004
literal-string eval.txt /*literal-string*
70037005
lnum-variable eval.txt /*lnum-variable*
7004-
load-plugin repeat.txt /*load-plugin*
70057006
load-plugins starting.txt /*load-plugins*
70067007
load-vim-script repeat.txt /*load-vim-script*
70077008
local-additions help.txt /*local-additions*
@@ -7667,6 +7668,7 @@ other-features vi_diff.txt /*other-features*
76677668
out-cb channel.txt /*out-cb*
76687669
out-timeout channel.txt /*out-timeout*
76697670
p change.txt /*p*
7671+
pack-add repeat.txt /*pack-add*
76707672
packages repeat.txt /*packages*
76717673
page-down intro.txt /*page-down*
76727674
page-up intro.txt /*page-up*

0 commit comments

Comments
 (0)