Skip to content

Commit da9c180

Browse files
committed
Don't track plugin channel in nvim
During debug, the plugin should inform nvim which plugin channel it is using.
1 parent 97315f1 commit da9c180

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

plugin/socketrepl.vim.debug

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
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
92

103
function! StartIfNotRunning()
11-
if g:is_running == 0
12-
let g:is_running = 1
13-
let g:channel = g:channel + 1
14-
endif
154
endfunction
165

176
function! Connect(host_colon_port)
@@ -21,45 +10,45 @@ function! Connect(host_colon_port)
2110
else
2211
let conn = a:host_colon_port
2312
endif
24-
let res = rpcrequest(g:channel, 'connect', conn)
13+
let res = rpcrequest(g:nvim_tcp_plugin_channel, 'connect', conn)
2514
return res
2615
endfunction
2716
command! -nargs=? Connect call Connect("<args>")
2817

2918
function! EvalBuffer()
3019
call StartIfNotRunning()
3120
ReplLog
32-
let res = rpcrequest(g:channel, 'eval-buffer', [])
21+
let res = rpcrequest(g:nvim_tcp_plugin_channel, 'eval-buffer', [])
3322
return res
3423
endfunction
3524
command! EvalBuffer call EvalBuffer()
3625

3726
function! EvalCode()
3827
call StartIfNotRunning()
3928
ReplLog
40-
let res = rpcrequest(g:channel, 'eval-code', [])
29+
let res = rpcrequest(g:nvim_tcp_plugin_channel, 'eval-code', [])
4130
return res
4231
endfunction
4332
command! EvalCode call EvalCode()
4433

4534
function! ReplLog(buffer_cmd)
4635
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)
4837
return res
4938
endfunction
5039
command! ReplLog call ReplLog(':botright new')
5140

5241
function! DismissReplLog()
5342
call StartIfNotRunning()
54-
let res = rpcrequest(g:channel, 'dismiss-log', [])
43+
let res = rpcrequest(g:nvim_tcp_plugin_channel, 'dismiss-log', [])
5544
return res
5645
endfunction
5746
command! DismissReplLog call DismissReplLog()
5847

5948
function! Doc()
6049
call StartIfNotRunning()
6150
ReplLog
62-
let res = rpcrequest(g:channel, 'doc', [])
51+
let res = rpcrequest(g:nvim_tcp_plugin_channel, 'doc', [])
6352
return res
6453
endfunction
6554
command! Doc call Doc()

src/user.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
(defn stop
1616
[]
17-
(system/stop @system-atom))
17+
(system/stop @system-atom)
18+
(reset! system-atom nil))
1819

1920
(defn reset
2021
[]

0 commit comments

Comments
 (0)