File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -144,8 +144,42 @@ function! ReadyCursorDoc()
144144endfunction
145145command ! DocCursor call ReadyCursorDoc ()
146146
147+ function ! Source ()
148+ ReplLog
149+ call inputsave ()
150+ let symbol = input (' Source for: ' )
151+ call inputrestore ()
152+ let res = rpcnotify (g: nvim_tcp_plugin_channel , ' source' , [symbol])
153+ return res
154+ endfunction
155+
156+ function ! ReadySource ()
157+ if g: socket_repl_plugin_ready == 1
158+ call Source ()
159+ else
160+ echo s: not_ready
161+ endif
162+ endfunction
163+ command ! Source call ReadySource ()
164+
165+ function ! SourceCursor ()
166+ ReplLog
167+ let res = rpcnotify (g: nvim_tcp_plugin_channel , ' source-cursor' , [])
168+ return res
169+ endfunction
170+
171+ function ! ReadyCursorSource ()
172+ if g: socket_repl_plugin_ready == 1
173+ call SourceCursor ()
174+ else
175+ echo s: not_ready
176+ endif
177+ endfunction
178+ command ! SourceCursor call ReadyCursorSource ()
179+
147180if ! exists (' g:disable_socket_repl_mappings' )
148181 nnoremap K :DocCursor<cr>
182+ nnoremap [d :SourceCursor<cr>
149183 nnoremap <leader> e :Eval<cr>
150184 nnoremap <leader> eb :EvalBuffer<cr>
151185 nnoremap <leader> ef :EvalForm<cr>
Original file line number Diff line number Diff line change 173173 (let [code (format " (clojure.repl/doc %s)" word)]
174174 (async/>!! code-channel code)))))))
175175
176+ (nvim/register-method!
177+ nvim
178+ " source"
179+ (run-command
180+ plugin
181+ (fn [msg]
182+ (let [code (format " (clojure.repl/source %s)" (-> msg
183+ message/params
184+ ffirst))]
185+ (async/>!! code-channel code)))))
186+
187+ (nvim/register-method!
188+ nvim
189+ " source-cursor"
190+ (run-command
191+ plugin
192+ (fn [msg]
193+ (api-ext/get-current-word-async
194+ nvim
195+ (fn [word]
196+ (let [code (format " (clojure.repl/source %s)" word)]
197+ (async/>!! code-channel code)))))))
198+
176199 (nvim/register-method!
177200 nvim
178201 " show-log"
You can’t perform that action at this time.
0 commit comments