##// END OF EJS Templates
Update docs on `.inputrc` and input mode....
Matthias Bussonnier -
Show More
@@ -254,61 +254,18 b' time you restart it. By default, the history file is named'
254 Autoindent
254 Autoindent
255 ++++++++++
255 ++++++++++
256
256
257 IPython can recognize lines ending in ':' and indent the next line,
257 Starting with 5.0, IPython user `prompt_toolkit` in place of ``readline``,
258 while also un-indenting automatically after 'raise' or 'return'.
258 it thus can recognize lines ending in ':' and indent the next line,
259
259 while also un-indenting automatically after 'raise' or 'return',
260 This feature uses the readline library, so it will honor your
260 and support real multi-line editing as well as syntactic coloration
261 :file:`~/.inputrc` configuration (or whatever file your :envvar:`INPUTRC` environment variable points
261 during edition.
262 to). Adding the following lines to your :file:`.inputrc` file can make
262
263 indenting/unindenting more convenient (M-i indents, M-u unindents)::
263 This feature does not use the ``readline`` library anymore – at least for now
264
264 – , so it will not honor your :file:`~/.inputrc` configuration (or whatever
265 # if you don't already have a ~/.inputrc file, you need this include:
265 file your :envvar:`INPUTRC` environment variable points to).
266 $include /etc/inputrc
266
267
267 In particular if you want to change the input mode to ``vi``, you will need to
268 $if Python
268 set the ``TerminalInteractiveShell.vi_mode`` configuration option of IPython.
269 "\M-i": " "
270 "\M-u": "\d\d\d\d"
271 $endif
272
273 Note that there are 4 spaces between the quote marks after "M-i" above.
274
275 .. warning::
276
277 Setting the above indents will cause problems with unicode text entry in
278 the terminal.
279
280 .. warning::
281
282 Autoindent is ON by default, but it can cause problems with the pasting of
283 multi-line indented code (the pasted code gets re-indented on each line). A
284 magic function %autoindent allows you to toggle it on/off at runtime. You
285 can also disable it permanently on in your :file:`ipython_config.py` file
286 (set TerminalInteractiveShell.autoindent=False).
287
288 If you want to paste multiple lines in the terminal, it is recommended that
289 you use ``%paste``.
290
291
292 Customizing readline behavior
293 +++++++++++++++++++++++++++++
294
295 All these features are based on the GNU readline library, which has an
296 extremely customizable interface. Normally, readline is configured via a
297 :file:`.inputrc` file. IPython respects this, and you can also customise readline
298 by setting the following :doc:`configuration </config/intro>` options:
299
300 * ``InteractiveShell.readline_parse_and_bind``: this holds a list of strings to be executed
301 via a readline.parse_and_bind() command. The syntax for valid commands
302 of this kind can be found by reading the documentation for the GNU
303 readline library, as these commands are of the kind which readline
304 accepts in its configuration file.
305 * ``InteractiveShell.readline_remove_delims``: a string of characters to be removed
306 from the default word-delimiters list used by readline, so that
307 completions may be performed on strings which contain them. Do not
308 change the default value unless you know what you're doing.
309
310 You will find the default values in your configuration file.
311
312
269
313 Session logging and restoring
270 Session logging and restoring
314 -----------------------------
271 -----------------------------
General Comments 0
You need to be logged in to leave comments. Login now