1
- let g:is_running = 0
2
- let g:channel = 0
3
-
4
- "When the plugin is restarted at the repl, it reconnects, using the next
5
- "available channel.
6
- function! PluginRestart()
7
- let g:is_running = 0
8
- endfunction
1
+ let g:nvim_tcp_plugin_channel = 0
9
2
10
3
function! StartIfNotRunning()
11
- if g:is_running == 0
12
- let g:is_running = 1
13
- let g:channel = g:channel + 1
14
- endif
15
4
endfunction
16
5
17
6
function! Connect(host_colon_port)
@@ -21,45 +10,45 @@ function! Connect(host_colon_port)
21
10
else
22
11
let conn = a:host_colon_port
23
12
endif
24
- let res = rpcrequest(g:channel , 'connect', conn)
13
+ let res = rpcrequest(g:nvim_tcp_plugin_channel , 'connect', conn)
25
14
return res
26
15
endfunction
27
16
command! -nargs=? Connect call Connect("<args>")
28
17
29
18
function! EvalBuffer()
30
19
call StartIfNotRunning()
31
20
ReplLog
32
- let res = rpcrequest(g:channel , 'eval-buffer', [])
21
+ let res = rpcrequest(g:nvim_tcp_plugin_channel , 'eval-buffer', [])
33
22
return res
34
23
endfunction
35
24
command! EvalBuffer call EvalBuffer()
36
25
37
26
function! EvalCode()
38
27
call StartIfNotRunning()
39
28
ReplLog
40
- let res = rpcrequest(g:channel , 'eval-code', [])
29
+ let res = rpcrequest(g:nvim_tcp_plugin_channel , 'eval-code', [])
41
30
return res
42
31
endfunction
43
32
command! EvalCode call EvalCode()
44
33
45
34
function! ReplLog(buffer_cmd)
46
35
call StartIfNotRunning()
47
- let res = rpcrequest(g:channel , 'show-log', a:buffer_cmd)
36
+ let res = rpcrequest(g:nvim_tcp_plugin_channel , 'show-log', a:buffer_cmd)
48
37
return res
49
38
endfunction
50
39
command! ReplLog call ReplLog(':botright new')
51
40
52
41
function! DismissReplLog()
53
42
call StartIfNotRunning()
54
- let res = rpcrequest(g:channel , 'dismiss-log', [])
43
+ let res = rpcrequest(g:nvim_tcp_plugin_channel , 'dismiss-log', [])
55
44
return res
56
45
endfunction
57
46
command! DismissReplLog call DismissReplLog()
58
47
59
48
function! Doc()
60
49
call StartIfNotRunning()
61
50
ReplLog
62
- let res = rpcrequest(g:channel , 'doc', [])
51
+ let res = rpcrequest(g:nvim_tcp_plugin_channel , 'doc', [])
63
52
return res
64
53
endfunction
65
54
command! Doc call Doc()
0 commit comments