Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reeflective/readline
Shell library with powerful and modern UI, large feature set, and `.inputrc` support
https://github.com/reeflective/readline
console go golang inputrc readline shell terminal vim vim-mode
Last synced: 16 days ago
JSON representation
Shell library with powerful and modern UI, large feature set, and `.inputrc` support
- Host: GitHub
- URL: https://github.com/reeflective/readline
- Owner: reeflective
- License: apache-2.0
- Created: 2020-07-30T18:59:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-17T23:29:10.000Z (3 months ago)
- Last Synced: 2024-08-18T00:18:35.649Z (3 months ago)
- Topics: console, go, golang, inputrc, readline, shell, terminal, vim, vim-mode
- Language: Go
- Homepage:
- Size: 16.7 MB
- Stars: 81
- Watchers: 5
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: history.go
- License: LICENSE
Awesome Lists containing this project
- awesome-go - readline
- fucking-awesome-go - readline
- awesome-go - readline
- awesome-go-with-stars - readline
- awesome-go-plus - readline
- awesome-go-plus - readline - 90-blue) ![forks](https://img.shields.io/badge/forks-12-blue) (Command Line / Standard CLI)
README
Readline
This library is a modern, pure Go `readline` shell implementation, with full `.inputrc` and legacy
readline command/option support, and extended with various commands, options and tools commonly
found in modern shells. Its architecture and completion system is heavily inspired from Z-Shell.
It is used, between others, to power the [console](https://github.com/reeflective/console) library.## Features
### Core
- Pure Go, almost-only standard library
- Cross-platform (Linux / MacOS / Windows)
- Full `.inputrc` support (all commands/options)
- Extensive test suite and almost full coverage of core code
- [Extended list](https://github.com/reeflective/readline/wiki/Keymaps-&-Commands) of additional commands/options (edition/completion/history)
- Complete [multiline edition/movement support](https://github.com/reeflective/readline/wiki/Multiline)
- Command-line edition in `$EDITOR`/`$VISUAL` support
- [Programmable API](https://github.com/reeflective/readline/wiki/Programmable-Commands), with failure-safe access to core components
- Support for an [arbitrary number of history sources](https://github.com/reeflective/readline/wiki/History-Sources)### Emacs / Standard
- Native Emacs commands
- Emacs-style [macro engine](https://github.com/reeflective/readline/wiki/Macros#emacs) (not working across multiple calls)
- Keywords [switching](https://github.com/reeflective/readline/wiki/Keymaps-&-Commands#modifying-text) (operators, booleans, hex/binary/digit) with iterations
- Command/mode cursor status indicator
- Complete undo/redo history
- Command status/arg/iterations hint display### Vim
- Near-native Vim mode
- Vim [text objects](https://github.com/reeflective/readline/wiki/Keymaps-&-Commands#text-objects) (code blocks, words/blank/shellwords)
- Extended surround select/change/add functionality, with highlighting
- Vim Visual/Operator pending mode & cursor styles indications
- Vim Insert and Replace (once/many)
- All Vim registers, with completion support
- [Vim-style](https://github.com/reeflective/readline/wiki/Macros#vim) macro recording (`q`) and invocation (`@`)### Interface
- Support for PS1/PS2/RPROMPT/transient/tooltip [prompts](https://github.com/reeflective/readline/wiki/Prompts) (compatible with [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh))
- Extended completion system, [keymap-based and configurable](https://github.com/reeflective/readline/wiki/Keymaps-&-Commands#completion), 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
- Builtin & programmable [syntax highlighting](https://github.com/reeflective/readline/wiki/Syntax-Highlighting)## Documentation
Readline is used by the [console library](https://github.com/reeflective/console) and its [example binary](https://github.com/reeflective/console/tree/main/example). To get a grasp of the
functionality provided by readline and its default configuration, install and start the binary.The documentation is available on the [repository wiki](https://github.com/reeflective/readline/wiki), for both users and developers.
## Showcases
- Emacs edition
- Vim edition
- Undo/redo line history
- Keyword switching & selection
- Vim selection & movements (basic)
- Vim surround (selection and change)
- Vim registers (with completion)
- History movements/completion/use/search
- Completion
- Prompts
- Logging
- Inputrc init file reload
- Multiline edition
- Macros
## Status
This library is now in a release status, as it has underwent several major rewrites and is now considered mostly
feature-complete, with a solid testing suite to ensure safe and smooth operation to the best extent possible.
New releases will be regularly pushed when bugs are found and corrected.
Additionally:
- Key dispatch/flushing, meta-key enable, etc might still contain some bugs/wrong behavior:
30 years of legacy support for 3000 different terminal emulators cannot be done right by me alone.
- Please open a PR or an issue if you face any bug, and it will be promptly resolved.
- Don't hesitate proposing a new feature or a PR if you deem it to be useful to most users.
## Credits
- @kenshaw for his `.inputrc` parsing package, which brings much wider compatibility to this library.
- `chzyer/readline` for the Windows I/O code and everything related.
- Some of the Vim code is inspired or translated from [zsh-vi-mode](https://github.com/jeffreytse/zsh-vi-mode).
- [lmorg/readline](https://github.com/lmorg/readline), for the line tokenizers.