Coder Social home page Coder Social logo

rl's Introduction


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.

rl's People

Contributors

maxlandon avatar torchedsammy avatar

Stargazers

Dmitry avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.