@@ -3,39 +3,44 @@ Vimteractive
3
3
============
4
4
:vimteractive: send commands from text files to interactive programs via vim
5
5
:Author: Will Handley
6
- :Version: 2.5 .0
6
+ :Version: 2.6 .0
7
7
:Homepage: https://github.com/williamjameshandley/vimteractive
8
8
:Documentation: ``:help vimteractive ``
9
9
10
10
Vimteractive was inspired by the workflow of the
11
11
`vim-ipython <https://github.com/ivanov/vim-ipython >`__ plugin.
12
12
13
13
This plugin is designed to extend a subset of the functionality of vim-ipython
14
- to other interpreters (including ipython). It is based around the unix
14
+ to other ` REPLs < https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop >`__ (including ipython). It is based around the unix
15
15
philosophy of `"do one thing and do it well" <https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well >`__.
16
16
Vimteractive aims to provide a robust and simple link between text files and
17
- interactive interpreters . Vimteractive will never aim to do things like
17
+ language shells . Vimteractive will never aim to do things like
18
18
autocompletion, leaving that to other, more developed tools such as
19
19
`YouCompleteMe <https://github.com/Valloric/YouCompleteMe >`__ or
20
- `TabNine <https://tabnine.com >`__.
21
-
22
- The activating commands are
23
-
24
- - ipython ``:Iipython ``
25
- - julia ``:Ijulia ``
26
- - maple ``:Imaple ``
27
- - mathematica ``:Imathematica ``
28
- - bash ``:Ibash ``
29
- - zsh ``:Izsh ``
30
- - python ``:Ipython ``
31
- - clojure ``:Iclojure ``
32
- - apl ``:Iapl ``
20
+ `Copilot <https://github.com/features/copilot >`__.
21
+
22
+ The activating commands are:
23
+
24
+ - `ipython <https://ipython.readthedocs.io >`__ ``:Iipython ``
25
+ - `julia <https://julialang.org/ >`__ ``:Ijulia ``
26
+ - `maple <https://maplesoft.com/ >`__ ``:Imaple ``
27
+ - `mathematica <https://www.wolfram.com/mathematica/ >`__ ``:Imathematica ``
28
+ - `bash <https://en.wikipedia.org/wiki/Bash_(Unix_shell) >`__ ``:Ibash ``
29
+ - `zsh <https://www.zsh.org/ >`__ ``:Izsh ``
30
+ - `python <https://www.python.org/ >`__ ``:Ipython ``
31
+ - `clojure <https://clojure.org/ >`__ ``:Iclojure ``
32
+ - `apl <https://en.wikipedia.org/wiki/APL_(programming_language) >`__ ``:Iapl ``
33
+ - `R <https://www.r-project.org/ >`__ ``:IR ``
34
+ - `sgpt <https://github.com/TheR1D/shell_gpt >`__ ``:Isgpt ``
33
35
- autodetect based on filetype ``:Iterm ``
34
36
35
- Commands may be sent from a text file to the chosen terminal using ``CTRL-S ``.
36
- If there is no terminal , ``CTRL-S `` will automatically open one for you using
37
+ Commands may be sent from a text file to the chosen REPL using ``CTRL-S ``.
38
+ If there is no REPL , ``CTRL-S `` will automatically open one for you using
37
39
``:Iterm ``.
38
40
41
+ For some terminals, the output of the last command may be retrieved with
42
+ ``CTRL-Y ``.
43
+
39
44
Note: it's highly recommended to use IPython as your default Python
40
45
interpreter. You can set it like this:
41
46
@@ -49,16 +54,6 @@ Installation
49
54
Since this package leverages the native vim interactive terminal, vimteractive
50
55
is only compatible with vim 8 or greater.
51
56
52
- To use the key-bindings, you should first disable the ``CTRL-S ``
53
- default, which is a terminal command to freeze the output. You can
54
- disable this by putting
55
-
56
- .. code :: bash
57
-
58
- stty -ixon
59
-
60
- into your ``.bashrc `` (or equivalent shell profile file).
61
-
62
57
Installation should be relatively painless via
63
58
`the usual routes <https://vimawesome.com/plugin/vimteractive >`_ such as
64
59
`Vundle <https://github.com/VundleVim/Vundle.vim >`__,
@@ -95,6 +90,17 @@ interface to the command line `maple <https://www.maplesoft.com/>`__.
95
90
Usage
96
91
-----
97
92
93
+ To use the key-bindings, you should first disable the ``CTRL-S ``
94
+ default, which is a terminal command to freeze the output. You can
95
+ disable this by putting
96
+
97
+ .. code :: bash
98
+
99
+ stty -ixon
100
+
101
+ into your ``.bashrc `` (or equivalent shell profile file).
102
+
103
+
98
104
Example usage:
99
105
~~~~~~~~~~~~~~
100
106
@@ -126,51 +132,68 @@ pressing ``CTRL-S``.
126
132
If you switch windows with ``CTRL-W+k ``, you will see the terminal buffer
127
133
switch to a more usual looking normal-mode buffer, from which you can perform
128
134
traditional normal mode commands. However, if you try to insert, you will enter
129
- the terminal , and be able to enter commands interactively into the prompt as if
135
+ the REPL , and be able to enter commands interactively into the prompt as if
130
136
you had run it in the command line. You can save this buffer if you wish to a
131
137
new file if it contains valuable output
132
138
133
- You may want to send lines to one terminal from two buffers. To achieve that,
139
+ You may want to send lines to one REPL from two buffers. To achieve that,
134
140
run ``:Iconn <buffer_name> `` where ``<buffer_name> `` is a name of buffer
135
- containing terminal . If there is only one terminal , you can use just
141
+ containing REPL . If there is only one REPL , you can use just
136
142
``:Iconn ``.
137
143
138
- Supported terminals
139
- ~~~~~~~~~~~~~~~~~~~
144
+ Supported REPLs
145
+ ~~~~~~~~~~~~~~~
140
146
141
- - ``:Iipython `` Activate an ipython terminal
142
- - ``:Ijulia `` Activate a julia terminal
143
- - ``:Imaple `` Activate a maple terminal
144
- - ``:Imathematica `` Activate a mathematica terminal
145
- - ``:Ibash `` Activate a bash terminal
146
- - ``:Izsh `` Activate a zsh terminal
147
- - ``:Ipython `` Activate a python terminal
148
- - ``:Iclojure `` Activate a clojure terminal
149
- - ``:Iapl `` Activate an apl terminal
150
- - ``:Iterm `` Activate default terminal for this filetype
147
+ - ``:Iipython `` Activate an ipython REPL
148
+ - ``:Ijulia `` Activate a julia REPL
149
+ - ``:Imaple `` Activate a maple REPL
150
+ - ``:Imathematica `` Activate a mathematica REPL
151
+ - ``:Ibash `` Activate a bash REPL
152
+ - ``:Izsh `` Activate a zsh REPL
153
+ - ``:Ipython `` Activate a python REPL
154
+ - ``:Iclojure `` Activate a clojure REPL
155
+ - ``:Iapl `` Activate an apl REPL
156
+ - ``:IR `` Activate an R REPL
157
+ - ``:Isgpt `` Activate an sgpt REPL
158
+ - ``:Iterm `` Activate default REPL for this filetype
151
159
152
160
Sending commands
153
161
~~~~~~~~~~~~~~~~
154
162
155
163
``CTRL-S `` sends lines of text to the interpreter in a mode-dependent manner:
156
164
157
- In Normal mode, ``CTRL-S `` sends the line currently occupied by the cursor the
158
- terminal .
165
+ In Normal mode, ``CTRL-S `` sends the line currently occupied by the cursor to the
166
+ REPL .
159
167
160
168
In Insert mode, ``CTRL-S `` sends the line currently being edited, and then
161
169
returns to insert mode at the same location.
162
170
163
- In Visual mode, ``CTRL-S `` sends the current selection to the terminal .
171
+ In Visual mode, ``CTRL-S `` sends the current selection to the REPL .
164
172
165
173
``ALT-S `` sends all lines from the start to the current line.
166
174
167
- Connecting to an existing terminal
168
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175
+ Retrieving command outputs
176
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
177
+
178
+ CTRL-Y retrieves the output of the last command sent to the REPL. This only
179
+ implemented in a subset of terminas (``:Iipython `` and ``:Isgpt ``)
180
+
181
+ In ``Normal-mode ``, CTRL-Y retrieves the output of the last command sent to the
182
+ REPL and places it in the current buffer.
183
+
184
+ In ``Insert-mode ``, CTRL-Y retrieves the output of the last command sent to the
185
+ REPL and places it in the current buffer, and then returns to insert mode
186
+ after the output.
187
+
188
+ Connecting to an existing REPL
189
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169
190
170
191
``:Iconn [{buffer] `` connects current buffer to REPL in ``{buffer} ``. You can
171
192
connect any number of buffers to one REPL. ``{buffer} `` can be omitted if there
172
- is only one terminal .
193
+ is only one REPL .
173
194
195
+ ``]v `` and ``[v `` can be used to cycle between connected buffers in the style of
196
+ `unimpaired <https://github.com/tpope/vim-unimpaired >`__.
174
197
175
198
Common issues
176
199
-------------
@@ -194,8 +217,8 @@ These options can be put in your ``.vimrc``, or run manually as desired:
194
217
195
218
.. code :: vim
196
219
197
- let g:vimteractive_vertical = 1 " Vertically split terminals
198
- let g:vimteractive_autostart = 0 " Don't start terminals by default
220
+ let g:vimteractive_vertical = 1 " Vertically split REPLs
221
+ let g:vimteractive_autostart = 0 " Don't start REPLs by default
199
222
200
223
Extending functionality
201
224
-----------------------
@@ -252,20 +275,3 @@ Similar projects
252
275
- `vipy <https://github.com/johndgiese/vipy >`__
253
276
254
277
.. |example_usage | image :: https://raw.githubusercontent.com/williamjameshandley/vimteractive/master/images/example_usage.gif
255
-
256
- Changelist
257
- ----------
258
- :v2.2: `Vertical splitting option <https://github.com/williamjameshandley/vimteractive/pull/21 >`__
259
- :v2.1: `Visual selection improvement <https://github.com/williamjameshandley/vimteractive/pull/15 >`__
260
- :v2.0: `Multiple terminal functionality <https://github.com/williamjameshandley/vimteractive/pull/9 >`__
261
- :v1.7: `Autodetection of terminals <https://github.com/williamjameshandley/vimteractive/pull/5 >`__
262
- :v1.6: CtrlP `bugfix <https://github.com/williamjameshandley/vimteractive/pull/4 >`__
263
- :v1.5: Added julia support
264
- :v1.4: `Buffer rename <https://github.com/williamjameshandley/vimteractive/pull/3 >`_
265
- :v1.3: Added zsh support
266
- :v1.2:
267
- - no line numbers in terminal window
268
- :v1.1:
269
- - `Bracketed paste <https://cirw.in/blog/bracketed-paste >`__ seems
270
- to fix most of ipython issues.
271
- - ``ALT-S `` sends all lines from start to current line.
0 commit comments