Diff to HTML by rtfpessoa

Files changed (4) hide show
  1. runtime/doc/builtin.txt +3 -1
  2. runtime/doc/channel.txt +57 -1
  3. runtime/doc/usr_41.txt +10 -9
  4. runtime/doc/version9.txt +5 -1
runtime/doc/builtin.txt CHANGED
@@ -1,4 +1,4 @@
1
- *builtin.txt* For Vim version 9.2. Last change: 2026 Feb 14
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -106,6 +106,8 @@ ch_evalraw({handle}, {string} [, {options}])
106
  ch_getbufnr({handle}, {what}) Number get buffer number for {handle}/{what}
107
  ch_getjob({channel}) Job get the Job of {channel}
108
  ch_info({handle}) String info about channel {handle}
 
 
109
  ch_log({msg} [, {handle}]) none write {msg} in the channel log file
110
  ch_logfile({fname} [, {mode}]) none start logging channel activity
111
  ch_open({address} [, {options}])
 
1
+ *builtin.txt* For Vim version 9.2. Last change: 2026 Mar 13
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
106
  ch_getbufnr({handle}, {what}) Number get buffer number for {handle}/{what}
107
  ch_getjob({channel}) Job get the Job of {channel}
108
  ch_info({handle}) String info about channel {handle}
109
+ ch_listen({address} [, {options}])
110
+ Channel listen on {address}
111
  ch_log({msg} [, {handle}]) none write {msg} in the channel log file
112
  ch_logfile({fname} [, {mode}]) none start logging channel activity
113
  ch_open({address} [, {options}])
runtime/doc/channel.txt CHANGED
@@ -1,4 +1,4 @@
1
- *channel.txt* For Vim version 9.2. Last change: 2026 Feb 25
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -114,6 +114,32 @@ Vim to write lines in log file: >
114
  call ch_logfile('channellog', 'w')
115
  See |ch_logfile()|.
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  ==============================================================================
118
  3. Opening a channel *channel-open*
119
 
@@ -641,6 +667,33 @@ ch_info({handle}) *ch_info()*
641
  <
642
  Return type: dict<any>
643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
  ch_log({msg} [, {handle}]) *ch_log()*
645
  Write String {msg} in the channel log file, if it was opened
646
  with |ch_logfile()|.
@@ -695,6 +748,9 @@ ch_open({address} [, {options}]) *ch_open()*
695
  If {options} is given it must be a |Dictionary|.
696
  See |channel-open-options|.
697
 
 
 
 
698
  Can also be used as a |method|: >
699
  GetAddress()->ch_open()
700
  <
 
1
+ *channel.txt* For Vim version 9.2. Last change: 2026 Mar 13
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
114
  call ch_logfile('channellog', 'w')
115
  See |ch_logfile()|.
116
 
117
+ You can also make Vim act as a server using |ch_listen()|. This does not
118
+ require an external server program.
119
+
120
+ *channel-listen-demo*
121
+ Start Vim and create a listening channel: >
122
+ func OnAccept(channel, clientaddr)
123
+ " Log the connection
124
+ echomsg "Accepted connection from " .. a:clientaddr
125
+
126
+ " Get current time and send it to the client
127
+ let current_time = strftime("%Y-%m-%d %H:%M:%S")
128
+ call ch_sendraw(a:channel, "Vim Server Time: " .. current_time .. "\n")
129
+
130
+ " Optional: close immediately if you only want to provide the time
131
+ call ch_close(a:channel)
132
+ endfunc
133
+
134
+ " Start listening on port 8765
135
+ let server = ch_listen('localhost:8765', {"callback": "OnAccept"})
136
+
137
+ From another Vim instance (or any program) you can connect to it: >
138
+ let channel = ch_open('localhost:8765')
139
+
140
+ When done, close the server channel: >
141
+ call ch_close(server)
142
+
143
  ==============================================================================
144
  3. Opening a channel *channel-open*
145
 
 
667
  <
668
  Return type: dict<any>
669
 
670
+ ch_listen({address} [, {options}]) *E1573* *E1574* *ch_listen()*
671
+ Listen on {address} for incoming channel connections.
672
+ This creates a server-side channel, unlike |ch_open()|
673
+ which connects to an existing server.
674
+ Returns a Channel. Use |ch_status()| to check for failure.
675
+
676
+ {address} is a String, see |channel-address| for the possible
677
+ accepted forms. Note: IPv6 is not yet supported.
678
+
679
+ If {options} is given it must be a |Dictionary|.
680
+ See |channel-open-options|.
681
+ The "callback" in {options} is invoked when a new
682
+ connection is accepted. It receives two arguments: the
683
+ new Channel and the client address as a String (e.g.
684
+ "127.0.0.1:12345").
685
+
686
+ Use |ch_open()| to connect to an existing server instead.
687
+
688
+ See |channel-listen-demo| for an example.
689
+
690
+ Can also be used as a |method|: >
691
+ GetAddress()->ch_listen()
692
+ <
693
+ {only available when compiled with the |+channel| feature}
694
+
695
+ Return type: channel
696
+
697
  ch_log({msg} [, {handle}]) *ch_log()*
698
  Write String {msg} in the channel log file, if it was opened
699
  with |ch_logfile()|.
 
748
  If {options} is given it must be a |Dictionary|.
749
  See |channel-open-options|.
750
 
751
+ Use |ch_listen()| to listen for incoming connections
752
+ instead.
753
+
754
  Can also be used as a |method|: >
755
  GetAddress()->ch_open()
756
  <
runtime/doc/usr_41.txt CHANGED
@@ -1287,23 +1287,24 @@ Testing: *test-functions*
1287
 
1288
  Inter-process communication: *channel-functions*
1289
  ch_canread() check if there is something to read
1290
- ch_open() open a channel
1291
  ch_close() close a channel
1292
  ch_close_in() close the in part of a channel
 
 
 
 
 
 
 
 
 
1293
  ch_read() read a message from a channel
1294
  ch_readblob() read a Blob from a channel
1295
  ch_readraw() read a raw message from a channel
1296
  ch_sendexpr() send a JSON message over a channel
1297
  ch_sendraw() send a raw message over a channel
1298
- ch_evalexpr() evaluate an expression over channel
1299
- ch_evalraw() evaluate a raw string over channel
1300
  ch_status() get status of a channel
1301
- ch_getbufnr() get the buffer number of a channel
1302
- ch_getjob() get the job associated with a channel
1303
- ch_info() get channel information
1304
- ch_log() write a message in the channel log file
1305
- ch_logfile() set the channel log file
1306
- ch_setoptions() set the options for a channel
1307
  json_encode() encode an expression to a JSON string
1308
  json_decode() decode a JSON string to Vim types
1309
  js_encode() encode an expression to a JSON string
 
1287
 
1288
  Inter-process communication: *channel-functions*
1289
  ch_canread() check if there is something to read
 
1290
  ch_close() close a channel
1291
  ch_close_in() close the in part of a channel
1292
+ ch_evalexpr() evaluate an expression over channel
1293
+ ch_evalraw() evaluate a raw string over channel
1294
+ ch_getbufnr() get the buffer number for a channel
1295
+ ch_getjob() get the Job of a channel
1296
+ ch_info() get information about a channel
1297
+ ch_listen() listen on a channel
1298
+ ch_log() write a message in the channel log
1299
+ ch_logfile() start logging channel activity
1300
+ ch_open() open a channel
1301
  ch_read() read a message from a channel
1302
  ch_readblob() read a Blob from a channel
1303
  ch_readraw() read a raw message from a channel
1304
  ch_sendexpr() send a JSON message over a channel
1305
  ch_sendraw() send a raw message over a channel
1306
+ ch_setoptions() set channel options
 
1307
  ch_status() get status of a channel
 
 
 
 
 
 
1308
  json_encode() encode an expression to a JSON string
1309
  json_decode() decode a JSON string to Vim types
1310
  js_encode() encode an expression to a JSON string
runtime/doc/version9.txt CHANGED
@@ -1,4 +1,4 @@
1
- *version9.txt* For Vim version 9.2. Last change: 2026 Mar 12
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -52606,6 +52606,10 @@ Added ~
52606
  -----
52607
  Various syntax, indent and other plugins were added.
52608
 
 
 
 
 
52609
  Autocommands: ~
52610
 
52611
  |SessionLoadPre| before loading a |Session| file
 
1
+ *version9.txt* For Vim version 9.2. Last change: 2026 Mar 13
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
52606
  -----
52607
  Various syntax, indent and other plugins were added.
52608
 
52609
+ Functions: ~
52610
+
52611
+ |ch_listen()| listen on {address}
52612
+
52613
  Autocommands: ~
52614
 
52615
  |SessionLoadPre| before loading a |Session| file