GIF created with evp
A bash plugin that replaces bash's line editor, readline, with reedline — the line editor powering nushell.
you keep your existing bash prompt, completions and history.
requires bash 5.3 or newer
cargo build --releaseEnable reedline-bash in your current bash session:
enable -f $PWD/target/release/libreedline_bash.so reedlineTo enable it permanently, add the same line to your ~/.bashrc:
echo "enable -f path/to/libreedline_bash.so reedline" >> ~/.bashrcYou can configure reedline-bash by creating a ~/.config/reedline-bash/config.toml file.
See config.example.toml for the defaults.
An edit applies from the next prompt, so there is no need to restart the shell.
Note that ~/.inputrc is not read: it configures readline, which no longer
sees your keys, so keybindings belong in config.toml.
Readline is linked into the bash binary, so it cannot be swapped out from outside. But bash's parser never calls readline directly — it reads characters through a function pointer, and that pointer can be replaced.
native bash reedline-bash
----------- -------------
parser parser
| |
v v
readline get_char <- We inject this by replacing
| | the `bash_input.getter` function
| v pointer.
| reedline
| |
v v
your terminal your terminal
- We load reedline-bash into the bash process with:
enable -f reedline-bash.so reedline - Once loaded
bash_input.getterpoints to ourget_char. Bash will read through it instead of readline. - Reedline draws the prompt and handles the editing, then returns the line.
- We hand it back byte by byte, and bash runs normally.
reedline-bash still uses your native bash completions and history, for inline suggestions and the completion menus provided by reedline.
- flyline: copied over the main logic for replacing bash's readline. reedline-bash includes some of its grammar definitions directly.
- reedline: the line editor we replace readline with
- flash: the shell lexer used
- bash: struct layouts and symbol names are checked against 5.3
This project's code is licensed under MIT.
Compiled binaries are licensed under GPLv3.
