@@ -3,46 +3,49 @@ Vimteractive
3
3
============
4
4
:vimteractive: send commands from text files to interactive programs via vim
5
5
:Author: Will Handley
6
- :Version: 2.2.0
6
+ :Version: 2.2.1
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
- This plugin is designed to extend a subset of the functionality of
14
- vim-ipython to other interpreters (including ipython). It is based
15
- around the unix philosophy of `"do one thing and do it
16
- well" <https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well> `__.
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
15
+ philosophy of `"do one thing and do it well" <https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well >`__.
17
16
Vimteractive aims to provide a robust and simple link between text files and
18
17
interactive interpreters. Vimteractive will never aim to do things like
19
18
autocompletion, leaving that to other, more developed tools such as
20
- `YouCompleteMe <https://github.com/Valloric/YouCompleteMe >`__.
19
+ `YouCompleteMe <https://github.com/Valloric/YouCompleteMe >`__ or
20
+ `TabNine <https://tabnine.com>``.
21
21
22
22
The activating commands are
23
23
24
24
- ipython ``:Iipython ``
25
- - python ``:Ipython ``
26
25
- julia ``:Ijulia ``
27
26
- maple ``:Imaple ``
28
27
- bash ``:Ibash ``
29
28
- zsh ``:Izsh ``
29
+ - python ``:Ipython ``
30
30
- clojure ``:Iclojure ``
31
31
- autodetect based on filetype ``:Iterm ``
32
32
33
- Commands may be sent from a text file to the chosen terminal using
34
- ``CTRL-S ``. If there is no terminal, ``CTRL-S `` will automatically
35
- open one for you using ``:Iterm ``.
33
+ Commands may be sent from a text file to the chosen terminal using ``CTRL-S ``.
34
+ If there is no terminal, ``CTRL-S `` will automatically open one for you using
35
+ ``:Iterm ``.
36
+
37
+ Note: it's highly recommended to use IPython as your default Python
38
+ interpreter. You can set it like this:
39
+
40
+ .. code :: vim
36
41
37
- It's highly recommended to set your default Python shell to IPython
38
- (see "Extending functionality" section for instructions). If you prefer
39
- not to do it, make sure, that every top-level block has at least one newline
40
- after it.
42
+ let g:vimteractive_default_shells = { 'python': 'ipython' }
41
43
42
44
Installation
43
45
------------
44
46
45
- Since this package leverages the native vim interactive terminal, vimteractive is only compatible with vim 8 or greater.
47
+ Since this package leverages the native vim interactive terminal, vimteractive
48
+ is only compatible with vim 8 or greater.
46
49
47
50
To use the key-bindings, you should first disable the ``CTRL-S ``
48
51
default, which is a terminal command to freeze the output. You can
@@ -71,22 +74,21 @@ Motivation
71
74
----------
72
75
73
76
`IPython and Jupyter <https://ipython.org/ >`__ are excellent tools for
74
- exploratory analyses in python. They leverage the interactivity of the
75
- python kernel to allow you to keep results of calculations in memory
76
- whilst developing further code to process them.
77
-
78
- However, I can't stand typing into anything other than vim. Anywhere
79
- else, my screen fills with hjklEB, or worse, I close the window with a
80
- careless ``<C-w> ``. I want a technique that allows me to operate on
81
- plain text files, but still be able to work interactively with the
82
- interpreter with minimal effort.
83
-
84
- `Many Projects <#similar-projects >`__ achieve this with a varying level
85
- of functionality. Vimteractive aims to create the simplest tool for
86
- sending things from text to interpreter, and making it easy to add
87
- additional interpreters. In particular, my main aim in starting this was
88
- to get a vim-ipython like interface to the command line
89
- `maple <https://www.maplesoft.com/ >`__.
77
+ exploratory analyses in python. They leverage the interactivity of the python
78
+ kernel to allow you to keep results of calculations in memory whilst developing
79
+ further code to process them.
80
+
81
+ However, I can't stand typing into anything other than vim. Anywhere else, my
82
+ screen fills with hjklEB, or worse, I close the window with a careless
83
+ ``<C-w> ``. I want a technique that allows me to operate on plain text files,
84
+ but still be able to work interactively with the interpreter with minimal
85
+ effort.
86
+
87
+ `Many Projects <#similar-projects >`__ achieve this with a varying level of
88
+ functionality. Vimteractive aims to create the simplest tool for sending things
89
+ from text to interpreter, and making it easy to add additional interpreters. In
90
+ particular, my main aim in starting this was to get a vim-ipython like
91
+ interface to the command line `maple <https://www.maplesoft.com/ >`__.
90
92
91
93
Usage
92
94
-----
@@ -110,69 +112,91 @@ Create a python file ``test.py`` with the following content:
110
112
ax.set_xlabel(' $x$' )
111
113
ax.set_ylabel(' $y$' )
112
114
113
- Now start an ipython interpreter in vim with ``:Iipython ``. You should
114
- see a preview window open above with your ipython prompt. Position your
115
- cursor over the first line of ``test.py ``, and press
116
- ``CTRL-S ``. You should see this line now appear in the first prompt of
117
- the preview window. Do the same with the second and fourth lines. At the
118
- fourth line, you should see a figure appear once it's constructed with
119
- ``plt.subplots() ``. Continue by sending lines to the interpreter. You
120
- can send multiple lines by doing a visual selection and pressing
121
- ``CTRL-S ``.
122
-
123
- If you switch windows with ``CTRL-W+k ``, you will see the terminal
124
- buffer switch to a more usual looking normal-mode buffer, from which you
125
- can perform traditional normal mode commands. However, if you try to
126
- insert, you will enter the terminal, and be able to enter commands
127
- interactively into the prompt as if you had run it in the command line.
128
- You can save this buffer if you wish to a new file if it contains
129
- valuable output
115
+ Now start an ipython interpreter in vim with ``:Iipython ``. You should see a
116
+ preview window open above with your ipython prompt. Position your cursor over
117
+ the first line of ``test.py ``, and press ``CTRL-S ``. You should see this line
118
+ now appear in the first prompt of the preview window. Do the same with the
119
+ second and fourth lines. At the fourth line, you should see a figure appear
120
+ once it's constructed with ``plt.subplots() ``. Continue by sending lines to the
121
+ interpreter. You can send multiple lines by doing a visual selection and
122
+ pressing ``CTRL-S ``.
123
+
124
+ If you switch windows with ``CTRL-W+k ``, you will see the terminal buffer
125
+ switch to a more usual looking normal-mode buffer, from which you can perform
126
+ traditional normal mode commands. However, if you try to insert, you will enter
127
+ the terminal, and be able to enter commands interactively into the prompt as if
128
+ you had run it in the command line. You can save this buffer if you wish to a
129
+ new file if it contains valuable output
130
130
131
131
You may want to send lines to one terminal from two buffers. To achieve that,
132
132
run ``:Iconn <buffer_name> `` where ``<buffer_name> `` is a name of buffer
133
- containing terminal. If there is only one terminal, you can use just ``:Iconn ``.
133
+ containing terminal. If there is only one terminal, you can use just
134
+ ``:Iconn ``.
134
135
135
136
Supported terminals
136
137
~~~~~~~~~~~~~~~~~~~
137
138
138
139
- ``:Iipython `` Activate an ipython terminal
139
- - ``:Ipython `` Activate a python terminal
140
140
- ``:Ijulia `` Activate a julia terminal
141
141
- ``:Imaple `` Activate a maple terminal
142
142
- ``:Ibash `` Activate a bash terminal
143
143
- ``:Izsh `` Activate a zsh terminal
144
+ - ``:Ipython `` Activate a python terminal
144
145
- ``:Iclojure `` Activate a clojure terminal
145
146
- ``:Iterm `` Activate default terminal for this filetype
146
147
147
148
Sending commands
148
149
~~~~~~~~~~~~~~~~
149
150
150
- ``CTRL-S `` sends lines of text to the interpreter in a mode-dependent
151
- manner:
151
+ ``CTRL-S `` sends lines of text to the interpreter in a mode-dependent manner:
152
152
153
- In Normal mode, ``CTRL-S `` sends the line currently occupied by the
154
- cursor the terminal.
153
+ In Normal mode, ``CTRL-S `` sends the line currently occupied by the cursor the
154
+ terminal.
155
155
156
- In Insert mode, ``CTRL-S `` sends the line currently being edited, and
157
- then returns to insert mode at the same location.
156
+ In Insert mode, ``CTRL-S `` sends the line currently being edited, and then
157
+ returns to insert mode at the same location.
158
158
159
159
In Visual mode, ``CTRL-S `` sends the current selection to the terminal.
160
160
161
161
``ALT-S `` sends all lines from the start to the current line.
162
162
163
+ Connecting to an existing terminal
164
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165
+
166
+ ``:Iconn [{buffer] `` connects current buffer to REPL in ``{buffer} ``. You can
167
+ connect any number of buffers to one REPL. ``{buffer} `` can be omitted if there
168
+ is only one terminal.
169
+
170
+
171
+ Common issues
172
+ -------------
173
+
174
+ Bracketed paste
175
+ ~~~~~~~~~~~~~~~
176
+
177
+ If you see strange symbols like ``^[[200~ `` when sending lines to your new
178
+ interpreter, you may be on an older system which does not have bracketed paste
179
+ enabled, or have other shell misbehaviour issues. You can change the default
180
+ setting with
181
+
182
+ .. code :: vim
183
+
184
+ let g:vimteractive_bracketed_paste_default = 0
185
+
186
+
163
187
Options
164
- ~~~~~~~
188
+ -------
165
189
These options can be put in your ``.vimrc ``, or run manually as desired:
166
190
167
191
.. code :: vim
168
192
169
- let g:vimteractive_vertical = 1 " Vertically split terminals
170
- let g:vimteractive_autostart = 0 " Don't start terminals by default
193
+ let g:vimteractive_vertical = 1 " Vertically split terminals
194
+ let g:vimteractive_autostart = 0 " Don't start terminals by default
171
195
172
196
Extending functionality
173
197
-----------------------
174
198
175
- This project is very much in an alpha phase, so if you have any issues
199
+ This project is very much in an beta phase, so if you have any issues
176
200
that arise on your system, feel free to `leave an issue <https://github.com/williamjameshandley/vimteractive/issues/new >`__ or create a `fork and pull
177
201
request <https://gist.github.com/Chaser324/ce0505fbed06b947d962> `__ with
178
202
your proposed changes
0 commit comments