| 1 |
Readlike |
| 2 |
======== |
| 3 |
|
| 4 |
A Python module that provides `GNU Readline`_-like line editing functions (the |
| 5 |
default Emacs-style ones). If you just want to use Readline, use the readline_ |
| 6 |
package in the standard library--but this package allows access to those |
| 7 |
capabilties in settings outside of a standard CLI. |
| 8 |
|
| 9 |
Currently, all stateless Readline commands are implemented. This means that |
| 10 |
yanking and history are not supported. |
| 11 |
|
| 12 |
This module is especially well-suited to interfacing with Urwid_ due to a |
| 13 |
shared syntax for describing key inputs. |
| 14 |
|
| 15 |
Installation |
| 16 |
------------ |
| 17 |
|
| 18 |
Install or upgrade to the latest version from PyPI_:: |
| 19 |
|
| 20 |
[sudo] pip install -U readlike |
| 21 |
|
| 22 |
Quick example |
| 23 |
------------- |
| 24 |
|
| 25 |
Transpose words:: |
| 26 |
|
| 27 |
>>> import readlike |
| 28 |
>>> readlike.edit('perilous siege', 9, 'meta t') |
| 29 |
('siege perilous', 14) |
| 30 |
|
| 31 |
Commands |
| 32 |
-------- |
| 33 |
|
| 34 |
Implemented commands and their correspondings keys are as follows:: |
| 35 |
|
| 36 |
backward-char ctrl b, left |
| 37 |
backward-delete-char ctrl h, backspace |
| 38 |
backward-kill-word ctrl meta h, meta backspace |
| 39 |
backward-word meta b, meta left |
| 40 |
beginning-of-line ctrl a, home |
| 41 |
capitalize-word meta c |
| 42 |
delete-char ctrl d, delete |
| 43 |
delete-horizontal-space meta \ |
| 44 |
downcase-word meta l |
| 45 |
end-of-line ctrl e, end |
| 46 |
forward-char ctrl f, right |
| 47 |
forward-word meta f, meta right |
| 48 |
kill-line ctrl k |
| 49 |
kill-word meta d, meta delete |
| 50 |
transpose-chars ctrl t |
| 51 |
transpose-words meta t |
| 52 |
unix-line-discard ctrl u |
| 53 |
unix-word-rubout ctrl w |
| 54 |
upcase-word meta u |
| 55 |
|
| 56 |
For more information about each command, see readline(3) or see the doc |
| 57 |
strings in readlike.py_. |
| 58 |
|
| 59 |
Projects using Readlike |
| 60 |
----------------------- |
| 61 |
|
| 62 |
- hangups_ |
| 63 |
|
| 64 |
.. _GNU Readline: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html |
| 65 |
.. _readline: https://docs.python.org/3/library/readline.html |
| 66 |
.. _PyPI: https://pypi.python.org/pypi/readlike |
| 67 |
.. _Urwid: http://urwid.org/ |
| 68 |
.. _readlike.py: https://github.com/jangler/readlike/blob/master/readlike.py |
| 69 |
.. _hangups: https://github.com/tdryer/hangups |