Skip to content

Commit f57969a

Browse files
committed
patch 7.4.1244
Problem: The channel functions don't sort together. Solution: Use a common "ch_" prefix.
1 parent fbf9c6b commit f57969a

4 files changed

Lines changed: 258 additions & 259 deletions

File tree

runtime/doc/eval.txt

Lines changed: 29 additions & 25 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 01
1+
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 02
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1810,6 +1810,13 @@ byteidxcomp( {expr}, {nr}) Number byte index of {nr}'th char in {expr}
18101810
call( {func}, {arglist} [, {dict}])
18111811
any call {func} with arguments {arglist}
18121812
ceil( {expr}) Float round {expr} up
1813+
ch_close( {handle}) none close a channel
1814+
ch_open( {address}, {mode} [, {callback}])
1815+
Number open a channel
1816+
ch_sendexpr( {handle}, {expr} [, {callback}])
1817+
any send {expr} over JSON channel {handle}
1818+
ch_sendraw( {handle}, {string} [, {callback}])
1819+
any send {string} over raw channel {handle}
18131820
changenr() Number current change number
18141821
char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
18151822
cindent( {lnum}) Number C indent for line {lnum}
@@ -1820,8 +1827,6 @@ complete_add( {expr}) Number add completion match
18201827
complete_check() Number check for key typed during completion
18211828
confirm( {msg} [, {choices} [, {default} [, {type}]]])
18221829
Number number of choice picked by user
1823-
connect( {address}, {mode} [, {callback}])
1824-
Number open a channel
18251830
copy( {expr}) any make a shallow copy of {expr}
18261831
cos( {expr}) Float cosine of {expr}
18271832
cosh( {expr}) Float hyperbolic cosine of {expr}
@@ -2029,10 +2034,6 @@ searchpairpos( {start}, {middle}, {end} [, {flags} [, {skip} [...]]])
20292034
List search for other end of start/end pair
20302035
searchpos( {pattern} [, {flags} [, {stopline} [, {timeout}]]])
20312036
List search for {pattern}
2032-
sendexpr( {handle}, {expr} [, {callback}])
2033-
any send {expr} over JSON channel {handle}
2034-
sendraw( {handle}, {string} [, {callback}])
2035-
any send {string} over raw channel {handle}
20362037
server2client( {clientid}, {string})
20372038
Number send reply string
20382039
serverlist() String get a list of available servers
@@ -2666,7 +2667,10 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
26662667
don't fit, a vertical layout is used anyway. For some systems
26672668
the horizontal layout is always used.
26682669

2669-
connect({address}, {mode} [, {callback}]) *connect()*
2670+
ch_close({handle}) *ch_close()*
2671+
Close channel {handle}. See |channel|.
2672+
2673+
ch_open({address}, {mode} [, {callback}]) *ch_open()*
26702674
Open a channel to {address}. See |channel|.
26712675
Returns the channel handle on success. Returns a negative
26722676
number for failure.
@@ -2680,6 +2684,23 @@ connect({address}, {mode} [, {callback}]) *connect()*
26802684
{callback} is a function that handles received messages on the
26812685
channel. See |channel-callback|.
26822686

2687+
ch_sendexpr({handle}, {expr} [, {callback}]) ch_*sendexpr()*
2688+
Send {expr} over JSON channel {handle}. See |channel-use|.
2689+
2690+
When {callback} is given returns immediately. Without
2691+
{callback} waits for a JSON response and returns the decoded
2692+
expression. When there is an error or timeout returns an
2693+
empty string.
2694+
2695+
When {callback} is zero no response is expected.
2696+
Otherwise {callback} must be a Funcref or the name of a
2697+
function. It is called when the response is received. See
2698+
|channel-callback|.
2699+
2700+
ch_sendraw({handle}, {string} [, {callback}]) *ch_sendraw()*
2701+
Send {string} over raw channel {handle}. See |channel-raw|.
2702+
Works like |ch_sendexpr()|, but does not decode the response.
2703+
26832704
*copy()*
26842705
copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
26852706
different from using {expr} directly.
@@ -5615,23 +5636,6 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *searchpos()*
56155636
< In this example "submatch" is 2 when a lowercase letter is
56165637
found |/\l|, 3 when an uppercase letter is found |/\u|.
56175638

5618-
sendexpr({handle}, {expr} [, {callback}]) *sendexpr()*
5619-
Send {expr} over JSON channel {handle}. See |channel-use|.
5620-
5621-
When {callback} is given returns immediately. Without
5622-
{callback} waits for a JSON response and returns the decoded
5623-
expression. When there is an error or timeout returns an
5624-
empty string.
5625-
5626-
When {callback} is zero no response is expected.
5627-
Otherwise {callback} must be a Funcref or the name of a
5628-
function. It is called when the response is received. See
5629-
|channel-callback|.
5630-
5631-
sendraw({handle}, {string} [, {callback}]) *sendraw()*
5632-
Send {string} over raw channel {handle}. See |channel-raw|.
5633-
Works like |sendexpr()|, but does not decode the response.
5634-
56355639
server2client( {clientid}, {string}) *server2client()*
56365640
Send a reply string to {clientid}. The most recent {clientid}
56375641
that sent a string can be retrieved with expand("<client>").

runtime/tools/demoserver.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
#!/usr/bin/python
2+
#
23
# Server that will accept connections from a Vim channel.
34
# Run this server and then in Vim you can open the channel:
4-
# :let handle = connect('localhost:8765', 'json')
5+
# :let handle = ch_open('localhost:8765', 'json')
56
#
67
# Then Vim can send requests to the server:
7-
# :let response = sendexpr(handle, 'hello!')
8+
# :let response = ch_sendexpr(handle, 'hello!')
89
#
910
# And you can control Vim by typing a JSON message here, e.g.:
1011
# ["ex","echo 'hi there'"]
1112
#
13+
# There is no prompt, just type a line and press Enter.
14+
# To exit cleanly type "quit<Enter>".
15+
#
1216
# See ":help channel-demo" in Vim.
17+
#
18+
# This requires Python 2.6 or later.
1319

1420
from __future__ import print_function
1521
import json

0 commit comments

Comments
 (0)