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
|
Readlike
========
A Python module that provides `GNU Readline`_-like line editing functions (the
default Emacs-style ones). If you just want to use Readline, use the readline_
package in the standard library--but this package allows access to those
capabilties in settings outside of a standard CLI.
Currently, all stateless Readline commands are implemented. This means that
yanking and history are not supported.
This module is especially well-suited to interfacing with Urwid_ due to a
shared syntax for describing key inputs.
Installation
------------
Install or upgrade to the latest version from PyPI_::
[sudo] pip install -U readlike
Quick example
-------------
Transpose words::
>>> import readlike
>>> readlike.edit('perilous siege', 9, 'meta t')
('siege perilous', 14)
Commands
--------
Implemented commands and their correspondings keys are as follows::
backward-char ctrl b, left
backward-delete-char ctrl h, backspace
backward-kill-word ctrl meta h, meta backspace
backward-word meta b, meta left
beginning-of-line ctrl a, home
capitalize-word meta c
delete-char ctrl d, delete
delete-horizontal-space meta \
downcase-word meta l
end-of-line ctrl e, end
forward-char ctrl f, right
forward-word meta f, meta right
kill-line ctrl k
kill-word meta d, meta delete
transpose-chars ctrl t
transpose-words meta t
unix-line-discard ctrl u
unix-word-rubout ctrl w
upcase-word meta u
For more information about each command, see readline(3) or see the doc
strings in readlike.py_.
Projects using Readlike
-----------------------
- hangups_
.. _GNU Readline: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
.. _readline: https://docs.python.org/3/library/readline.html
.. _PyPI: https://pypi.python.org/pypi/readlike
.. _Urwid: http://urwid.org/
.. _readlike.py: https://github.com/jangler/readlike/blob/master/readlike.py
.. _hangups: https://github.com/tdryer/hangups
|