This library is a modern, pure Go readline implementation, enhanced with editing and user interface features commonly found in modern shells, all in little more than 10K lines of code. Its kemap-based model and completion engine is heavily inspired from the Z-Shell architecture. It is used, between others, to power the console library.
- Near-native Emacs and Vim modes.
- Configurable bind keymaps, with live reload and sane defaults.
- Extended list of edition/movement/control widgets (Emacs and Vim).
- Extended surround select/change/add fonctionality, with highlighting.
- Keywords switching (operators, booleans, hex/binary/digit) with iterations.
- Support for Vim Visual/Operator pending mode & cursor styles indications.
- Vim Insert and Replace (once/many).
- Many Vim text objects.
- All Vim registers, with completion support.
- Undo/redo history.
- Command-line edition in
$EDITOR
. - Support for an arbitrary number of history sources.
- Support for most of oh-my-posh prompts (PS1/PS2/RPROMPT/transient/tooltip).
- Extended completion system, keymap-based and configurable, easy to populate & use.
- Multiple completion display styles, with color support.
- Completion & History incremental search system & highlighting (fuzzy-search).
- Automatic & context-aware suffix removal for efficient flags/path/list completion.
- Optional asynchronous autocomplete.
- Usage/hint message display.
- Support for syntax highlighting
Readline is used by the console library and its example binary. To get a grasp of the functionality provided by readline and its default configuration, install and start the binary.
- Introduction
- Configuration file
- Keymaps & Widgets
- Prompts
- History Sources
- Vim mode
- Custom callbacks
- Completions & Hints
- Other features
- Emacs edition
- Vim surround (selection and change)
- History movements/completion/use/search
This library is in a pre-release status, although pretending to be quite bug-free as compared to its feature set. Please open a PR or an issue if you wish to bring enhancements to it. Other contributions, as well as bug fixes and reviews are also welcome.
- While most of the code has been rewritten from scratch, the original library used is lmorg/readline. I would have never ventured myself doing this if he had not ventured writing a Vim mode core in the first place.
- Some of the Vim code is inspired or translated from zsh-vi-mode.