File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ let s:p_dir = expand('<sfile>:p:h')
2
2
let g: is_running = 0
3
3
let g: socket_repl_plugin_ready = 0
4
4
let g: nvim_tcp_plugin_channel = 0
5
+ let g: eval_entire_ns_decl = 0 " 0 = SwitchBufferNS uses `in-ns`. 1 = SwitchBufferNS evals entire ns declaration
5
6
6
7
let s: not_ready = " SocketREPL plugin not ready (starting)"
7
8
@@ -177,6 +178,19 @@ function! ReadyCursorSource()
177
178
endfunction
178
179
command ! SourceCursor call ReadyCursorSource ()
179
180
181
+ function ! SwitchBufferNS ()
182
+ call rpcnotify (g: nvim_tcp_plugin_channel , ' switch-buffer-ns' , [])
183
+ endfunction
184
+
185
+ function ! ReadySwitchBufferNS ()
186
+ if g: socket_repl_plugin_ready == 1
187
+ call SwitchBufferNS ()
188
+ else
189
+ echo s: not_ready
190
+ endif
191
+ endfunction
192
+ command ! SwitchBufferNS call ReadySwitchBufferNS ()
193
+
180
194
if ! exists (' g:disable_socket_repl_mappings' )
181
195
nnoremap K :DocCursor<cr>
182
196
nnoremap [d :SourceCursor<cr>
Original file line number Diff line number Diff line change 234
234
235
235
(nvim/register-method!
236
236
nvim
237
- " eval -buffer-ns"
237
+ " switch -buffer-ns"
238
238
(run-command
239
239
plugin
240
240
(fn [msg]
241
241
(let [buffer-name (api/get-current-buf nvim)
242
242
file-name (api.buffer/get-name nvim buffer-name)
243
243
file (io/file file-name)
244
- namespace-declarations (namespace.find/find-ns-decls-in-dir file)]
245
- (async/>!! (socket-repl/input-channel socket-repl) (first namespace-declarations))))))
244
+ namespace-declaration (first (namespace.find/find-ns-decls-in-dir file))
245
+ eval-entire-declaration? (= 1 (api/get-var nvim " eval_entire_ns_decl" ))
246
+ code-form (if eval-entire-declaration?
247
+ namespace-declaration
248
+ `(clojure.core/in-ns '~(second namespace-declaration)))]
249
+ (async/>!! (socket-repl/input-channel socket-repl) code-form)))))
246
250
247
251
(nvim/register-method!
248
252
nvim
You can’t perform that action at this time.
0 commit comments