GitHub - reeflective/readline: Shell library with modern and simple UI features
source link: https://github.com/reeflective/readline
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Readline
Shell library with modern and simple UI features
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- Vim edition- Undo/redo line history - Keyword switching - Vim selection & movements (basic) - Vim surround (selection and change) - Vim registers (with completion) - History movements/completion/use/search History movement, completion and some other other widgets
- Completion - 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.
Recommend
-
217
Files Permalink Latest commit message Co...
-
75
readline.vim Readline is a library used for implementing line editing across many command-line tools (including Bash and other shells and interpreters). Readline ships with a default set of key-bindings that you are probably already fami...
-
64
README.markdown rsi.vim You know Readline key bindings? Of course you do, they're in your shell, your REPL, and perhaps even the GUI for your OS. They're similar to Emacs key bindings (C-a fo...
-
51
Readline is one of those technologies that is so commonly used many users don’t realise it’s there. I went looking for a good primer on it so I could understand it better, but failed to find one. This is an attem...
-
68
I sometimes think of my computer as a very large house. I visit this house every day and know most of the rooms on the ground floor, but there are bedrooms I’ve never been in, closets I haven’t opened, nooks and crannies t...
-
44
Entering Input Mode ...
-
23
Fixing Ruby readline.bundle Image Not Found Aug 30, 2019 I've seen a lot of ruby weirdness over the years but this one was new to me: 1) Metric#color reps should be green when the goa...
-
0
readlineSync Now, ECMAScript supports Promise, await and async. Synchronous Readline for interactively runnin...
-
9
Console Closed-loop application library for Cobra commands (Menus, oh-my-posh prompts, bells and whistles, easy to use) Console is an all-in-one console application library built on top of a
-
10
Flags Generate cobra commands from structs jessevdk/go-flags and octago/sflags compliant tags. Enhanced with advanced related CLI functionality, at minimum cost. Summary The fla...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK