forked from jpalardy/vim-slime-ext-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim-slime.txt
185 lines (134 loc) · 8.24 KB
/
vim-slime.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
*slime.txt* Grab some text and "send" it to a REPL session.
Author: Jonathan Palardy *slime-author*
License: Same terms as Vim itself (see |license|)
This plugin is only available if 'compatible' is not set.
==============================================================================
*slime*
Grab some text and "send" it to a REPL session.
VIM --> vim-slime --> REPL~
Presumably, your session contains a REPL, maybe Clojure, R or python. If you
can type text into it, vim-slime can send text to it.
The reason you're doing this? Because you want the benefits of a REPL and the
benefits of using Vim (familiar environment, syntax highlighting, persistence
...).
1. Slime Usage...................................................|slime-usage|
2. Plugin Configuration...........................|slime-plugin-configuration|
3. Available Plugins...........................................|slime-plugins|
4. Slime Configuration...................................|slime-configuration|
5. Slime functions...........................................|slime-functions|
==============================================================================
1. Slime Usage *slime-usage*
*CTRL-C_CTRL-C* *<c-c><c-c>*
<c-c><c-c> Send the current paragraph text to REPL. Slime will prompt
for configuration if slime is not configured for the
current buffer.
*v_CTRL-C_CTRL-C* *v_<c-c><c-c>*
{Visual}<c-c><c-c> Send highlighted text to REPL.
*CTRL-C_v* *<c-c>v*
*:SlimeConfig*
<c-c>v Setup slime. You will be prompted for information
:SlimeConfig regarding plugin configuration if needed.
*:SlimeSend*
:<range>SlimeSend Send a [range] of lines to REPL. If no range is provided
the current line is sent.
See |slime-configuration| for advanced commands and mappings.
==============================================================================
2. Plugin Configuration *slime-plugin-configuration*
Vim-slime needs a plugin to actually send your code to the REPL. Several
plugins are available, see |slime-plugins|.
A plugin should expose at least one target function that will be used by
vim-slime to send data to the REPL. The signature must be :
`MyTargetFunction(config, text)`
With `config` being the configuration variable and `text` the text which is to
be sent. Vim-slime takes care to initialize the configuration by calling the
defined configuration function. Such a function must have the following
signature :
`MyConfigFunction(config)`
And return the modified configuration.
Both target and configuration functions must be declared to vim-slime using
|b:slime_target_send| or |g:slime_target_send| and |b:slime_target_config| and
|g:slime_target_config| respectively. The buffer variable takes precedence
over the global variable, so you can use different plugins for different
buffers.
Note: If your plugin does not need any configuration, you can register
`slime#noop` instead of your configuration function.
==============================================================================
3. Available Plugins *slime-plugins*
You can find a list of available target plugins at
https://github.com/jpalardy/vim-slime-ext-plugins
==============================================================================
4. Slime Configuration *slime-configuration*
Global Variables~
*g:slime_target_send* |string| used to register the plugin's target
function
*g:slime_target_config* |string| used to register the plugin's configuration
function
*g:slime_no_mappings* If set, disable the default mappings.
Buffer Variables~
*b:slime_target_send* Same as |g:slime_target_send|, but takes precedence
over it.
*b:slime_target_config* Same as |g:slime_target_config| but takes
precedence over it.
Mappings~
Note: The default mappings can be disabled using |g:slime_no_mappings|.
*<Plug>SlimeRegionSend* Send text in visual or select mode. Default
mapping is <c-c><c-c> in normal and select mode.
*<Plug>SlimeParagraphSend* Send the current paragraph. Default mapping is
<c-c><c-c> in normal mode.
*<Plug>SlimeConfig* Trigger plugin configuration. Default mapping is
<c-c>v in normal mode.
*<Plug>SlimeMotionSend* The slime operator allows user to send the
current selection. Seel |slime-operator-example|.
*<Plug>SlimeLineSend* Send the current line to REPL.
Commands~
*:SlimeConfig* Trigger plugin configuration.
*:SlimeSend* Send the lines given in parameters.
`:3,7SlimeSend` will send lines 3 to 7 to REPL.
You can also use |marks|.
*:SlimeSend1* Send the given parameter string to REPL.
`:SlimeSend1 print("Hello World")` will send
`print("Hello World")` followed by a newline
character ("\r") to REPL.
*:SlimeSend0* Same as |:SlimeSend1|, without newline character.
*:SlimeSendCurrentLine* Send current line to REPL.
*slime-operator-example*
SlimeMotionSend example~
Vim-slime defines its own |operator| that allows you to use all kind of
motions (see |motion.txt|) to send your data.
For example |<Plug>SlimeParagraphSend| is defined as |<Plug>SlimeMotionSendip|,
which calls |<Plug>SlimeMotionSend| on the current "inner paragraph" (see |ip|).
By default |<Plug>SlimeMotionSend| is not mapped. Users can create their own
mapping in their configuration file, e.g. :
`noremap cs <Plug>SlimeMotionSend`
With the above mapping it becomes possible for users to finely tune what they
send. Thus, in the following configuration >
This is "some fairly nice" text
⮤ Cursor is here
>
Pressing `csi"` will send `some fairly nice` to the REPL.
==============================================================================
5. Slime functions *slime-functions*
Vim-slime defines a public interface that you can use.
slime#send({text}) *slime#send()*
Send the given {text} to the target.
slime#config() *slime#config()*
Trigger vim-slime configuration and return the configuration. If
vim-slime is already configured for the current buffer, return the
current configuration.
slime#reconfig() *slime#reconfig()*
Force vim-slime reconfiguration. Erase current buffer configuration
and call |slime#config()|.
slime#noop(...) *slime#noop()*
Do nothing. Useful to feed to |g:slime_target_config| when a plugin
does not need any configuration.
slime#send_op({type}, ...) *slime#send_op()*
The operator function used by |<Plug>SlimeMotionSend|. It is intended
to be used either manually or through |g@|. To use it manually, you
should set |a:0| to something (the actual value does not matter).
When used manually, |slime#send_op()| selects what is between the
|`<| and |`>| tags (last selected Visual area in current buffer)
with the given {type} mode. You could for example use the last
visual mode, given by |visualmode()|.
slime#send_range({startline}, {endline}) *slime#send_range()*
Send the lines from {startline} to {endline}.
vim:tw=78:ts=8:ft=help:norl: