@@ -10,22 +10,35 @@ TODO: architecture diagram
10
10
11
11
## Usage
12
12
13
- After starting a Clojure application with a socket repl server.
13
+ Start a Clojure program with a socket repl server. This can be done by
14
+ adding the following JVM options to any Clojure application.
15
+
16
+ ```
17
+ -Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"
18
+ ```
19
+
20
+ Then, from within Neovim, connect to the socket repl.
14
21
15
22
```
16
23
:Connect <host> <port>
17
24
```
18
25
19
- Create a buffer for displaying interaction with the repl. In that buffer:
26
+ Create a buffer for displaying interaction with the repl.
20
27
21
28
```
29
+ :vnew
22
30
:ReplLog
23
31
```
24
32
25
33
From there, to eval any buffer or form under cursor use:
26
34
27
35
```
28
36
:EvalBuffer
37
+ ```
38
+
39
+ or
40
+
41
+ ```
29
42
:EvalCode
30
43
```
31
44
@@ -52,12 +65,19 @@ This plugin requires a version of the Java version 1.6 or higher. You've probabl
52
65
53
66
## Developing
54
67
55
- Start Neovim using:
68
+ Start Neovim using, open the debug plugin script.
56
69
57
70
```
58
71
NVIM_LISTEN_ADDRESS=127.0.0.1:7777 nvim plugin/socketrepl.vim.debug
59
72
```
60
73
74
+ From within Neovim, source the debug plugin script. This causes it to use
75
+ a socket connection, rather than stdio to communicate with the plugin.
76
+
77
+ ```
78
+ :so %
79
+ ```
80
+
61
81
Start the plugin. Then you'll need to connect to Neovim from the repl.
62
82
63
83
```
@@ -66,11 +86,18 @@ $> nc localhost 5555
66
86
user=> (go)
67
87
```
68
88
69
- or, with Leiningen:
89
+ or, with Leiningen
70
90
71
91
```
72
92
$> lein repl
73
93
$> (go)
74
94
```
75
95
76
- You can now use plugin commands from within Neovim ` :Connect ` , ` :EvalBuffer ` , etc.
96
+ You can now use plugin commands from within Neovim ` :Connect ` , ` :EvalBuffer ` ,
97
+ etc.
98
+
99
+ Note that you'll probably want to rely heavily on the asynchronous
100
+ neovim-client functions when you want (the plugin) to make a request
101
+ of neovim. This is because the Neovim function ` rpcrequest ` blocks until
102
+ it has received a response (from your plugin). Using async on the plugin
103
+ side is the easiest way to avoid deadlock.
0 commit comments