-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
75 lines (60 loc) · 2.52 KB
/
README
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
This is a mirror of http://www.vim.org/scripts/script.php?script_id=3231
This plugin is a simple realization of read-eval-print loop for Python in Vim command window. It requires Python support (see +python) and at least version 2.6 of Python interpreter (you can check python version by running :py import sys; print(sys.version) ).
Features:
- auto-completion (tab)
- auto-indent
- keeps your recent results in the result history, for later user.
- IPython-like magic operators (e.g. object?)
- evaluate selected code
- and more (see the pyinteractive documentation for details)
Demonstration (ver 0.5): http://www.youtube.com/watch?v=oy9Cv3eKy-0&feature=plcp
Project home: https://github.com/clericJ/pyinteractive-vim
Commands:
:PyInteractiveREPL
Opens an interactive Python console in vim. If you want to finish working with the interpreter,
press <esc>. Interpreter states are saved between PyInteractive sessions (but not between vim
sessions), so that if you use PyInteractiveREPL, type x=1 here, close it and then reopen again,
variable x will still have value 1.
:PyInteractiveHistory [options]
Echoes session history.
Possible options:
-r Print history without any formatting (mnemonic: raw)
-i Print only input history (mnemonic: input)
-o Print only output history (mnemonic: output)
-f {FILE} Write history to file {FILE}
:PyInteractiveEval {code}
Evaluate given code in the interpreter. Command is useful for quickly testing results
and for scripting purposes (for example, in context menu). Example:
:PyInteractiveEval def inc(x): return x+1
:PyInteractiveEval inc(1)
2
:PyInteractiveREPL
>>> inc(10)
11
:PyInteractiveRunBuffer
Execute current buffer in python interpreter and show result.
Autocompletion is defined for PyInteractiveEval command and for input() opened by PyInteractiveREPL command and can be accessed by pressing <tab> key (default, see wildchar if you want to change this).
Examples:
:PyInteractiveREPL
>>> def inc_10(x):
... return x+10
...
>>> inc_10(7)
17
>>> import sys
>>> sys.ex<tab> # codecompletion (see pyinteractive-autocompletion)
<built-in function exit>
<ESC>
:PyInteractiveEval inc_10(11) +1
22
:PyInteractiveHistory
in[1]: def inc_10(x):
in[2]: return x+10
in[3]:
in[4]: inc_10(7)
out[1]: 17
in[5]: import sys
in[6]: sys.exit
out[2]: <built-in function exit>
in[7]: inc_10(11) +1
out[3]: 22