Skip to content
/ rl Public
forked from reeflective/readline

ZSH-like console library in Go (forked from github.com/lmorg/readline)

License

Notifications You must be signed in to change notification settings

Rosettea/rl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Readline

Shell library with modern and simple UI features

Github Actions (workflows) Go module version GoDoc reference Go Report Card codecov License: BSD-3

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.

Features

Editing

  • 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.

Interface

  • 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

Documentation

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.

Showcases

- Emacs edition
(This extract is quite a pity, because its author is not using Emacs and does not know many of its shortcuts)
- Vim edition
- Undo/redo line history
- Keyword switching
- Vim selection & movements (basic)
- Vim surround (selection and change)
Basic surround selection changes/adds
Surround and change in shellwords, matching brackets, etc.
- Vim registers (with completion)
- History movements/completion/use/search
History movement, completion and some other other widgets
History cycling and search
- Completion
Classic mode & incremental search mode
Smart terminal estate management
- Suffix autoremoval
- Prompts
- Logging
- Configuration hot-reload

Status

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.

Credits

  • 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.

About

ZSH-like console library in Go (forked from github.com/lmorg/readline)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%