Show More
@@ -0,0 +1,29 b'' | |||||
|
1 | Automatic Vi prompt stripping | |||
|
2 | ============================= | |||
|
3 | ||||
|
4 | When pasting code into IPython, it will strip the leading prompt characters if | |||
|
5 | there are any. For example, you can paste the following code into the console - | |||
|
6 | it will still work, even though each line is prefixed with prompts (`In`, | |||
|
7 | `Out`):: | |||
|
8 | ||||
|
9 | In [1]: 2 * 2 == 4 | |||
|
10 | Out[1]: True | |||
|
11 | ||||
|
12 | In [2]: print("This still works as pasted") | |||
|
13 | ||||
|
14 | ||||
|
15 | Previously, this was not the case for the Vi-mode prompts:: | |||
|
16 | ||||
|
17 | In [1]: [ins] In [13]: 2 * 2 == 4 | |||
|
18 | ...: Out[13]: True | |||
|
19 | ...: | |||
|
20 | File "<ipython-input-1-727bb88eaf33>", line 1 | |||
|
21 | [ins] In [13]: 2 * 2 == 4 | |||
|
22 | ^ | |||
|
23 | SyntaxError: invalid syntax | |||
|
24 | ||||
|
25 | This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are | |||
|
26 | skipped just as the normal ``In`` would be. | |||
|
27 | ||||
|
28 | IPython shell can be started in the Vi mode using ``ipython | |||
|
29 | --TerminalInteractiveShell.editing_mode=vi`` |
General Comments 0
You need to be logged in to leave comments.
Login now