Skip to content

Commit 31a6af7

Browse files
committed
Create default mappings for socket repl plugin
1 parent 1c353f6 commit 31a6af7

File tree

3 files changed

+41
-10
lines changed

3 files changed

+41
-10
lines changed

socket-repl-plugin/README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,35 @@ adding the following JVM options to any Clojure application.
1717
-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"
1818
```
1919

20-
Then, from within Neovim, connect to the socket repl.
20+
Create a buffer for displaying interaction with the repl.
2121

2222
```
23-
:Connect <host> <port>
23+
<leader>rlog
2424
```
2525

26-
Create a buffer for displaying interaction with the repl.
26+
From there, to eval any buffer or form under cursor use:
2727

2828
```
29-
:vnew
30-
:ReplLog
29+
<leader>eb
3130
```
3231

33-
From there, to eval any buffer or form under cursor use:
32+
or
3433

3534
```
36-
:EvalBuffer
35+
<leader>ef
3736
```
3837

39-
or
38+
Note that the above leader-based mappings can be disabled by setting
39+
`g:disable_socket_repl_mappings` to `1` in your .vimrc. The following commands
40+
are available to create your own mappings:
4041

4142
```
42-
:EvalCode
43+
:EvalBuffer
44+
:EvalForm
45+
:ReplLog
4346
```
47+
Unlike the `<leader>rlog` mapping, the `:ReplLog` command simply adds the repl
48+
log to the current pane.
4449

4550
TODO: demo video
4651

socket-repl-plugin/plugin/socketrepl.vim

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,17 @@ function! ReplLog()
4141
endfunction
4242
command! ReplLog call ReplLog()
4343

44-
echo 'prod socket repl plugin loaded!'
44+
if !exists('g:disable_socket_repl_mappings')
45+
nnoremap <leader>eb :EvalBuffer<cr>
46+
nnoremap <leader>ef :EvalCode<cr>
47+
48+
function! ShowLog()
49+
vnew
50+
ReplLog
51+
norm 
52+
norm 
53+
endfunction
54+
nnoremap <leader>rlog :call ShowLog()<cr>
55+
endif
56+
57+
echo 'socket repl plugin loaded!'

socket-repl-plugin/plugin/socketrepl.vim.debug

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@ function! ReplLog()
2525
endfunction
2626
command! ReplLog call ReplLog()
2727

28+
if !exists('g:disable_socket_repl_mappings')
29+
nnoremap <leader>eb :EvalBuffer<cr>
30+
nnoremap <leader>ef :EvalCode<cr>
31+
32+
function! ShowLog()
33+
vnew
34+
ReplLog
35+
norm 
36+
norm 
37+
endfunction
38+
nnoremap <leader>rlog :call ShowLog()<cr>
39+
endif
40+
2841
echo 'debug socket repl plugin loaded!'

0 commit comments

Comments
 (0)