Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

flyline

> 开发工具
Open source

Flyline: a Bash plugin to replace readline for a modern line editing experience: syntax highlighting, agent integration, rich prompts, tooltips, fuzzy history s

1.0K stars0 likes1 views
WebsiteGitHub

About

Flyline: a Bash plugin to replace readline for a modern line editing experience: syntax highlighting, agent integration, rich prompts, tooltips, fuzzy history s

Flyline

When Bash prompts you for a command, a library called readline handles your keystrokes. Readline lacks many features users have come to expect. Flyline is a readline replacement that provides an enhanced line editing experience with:

  • Intellisense style autosuggestions
  • Change directory using your prompt
  • Rich prompt customizations, (asynchronous widgets), and animations
  • Fuzzy history searching
  • Mouse support (click to move cursor, select text)
  • Improvements to Bash's tab completion
  • Synthesize tab completion suggestions with flycomp
  • Agent assisted command writing
  • Tooltips
  • Text selection
  • Auto close brackets and quotes
  • Syntax highlighting
  • Runs in the same process as Bash
  • Cursor animations and styles

Flyline is similar to ble.sh but is written in Rust and uses ratatui.rs to more easily draw complex user interfaces.

Who is it for?

  1. You want an out-of-the-box great shell experience without the hassle of setting up half a dozen plugins, plugin managers, keyboard shortcuts, and startup scripts (any one of which might phone home).
  2. You're a terminal power user who wants to fine-tune their shell experience by writing in a modern language like Rust. Flyline can be the starting platform for you; contributions welcome!

Installation

[!IMPORTANT] After installing, run flyline run-tutorial and if you don't like the mouse capturing: flyline mouse --mode disabled

Quick install: install.sh

[!TIP] Run this command in bash to download flyline and update your .bashrc to load the latest version. No need for sudo!

bash
source /dev/null || enable -f /path/to/libflyline.so flyline
flyline run-tutorial

Build from source

Clone the repo and run:

bash
cargo build
enable flyline 2>/dev/null || enable -f /path/to/flyline_checkout/target/debug/libflyline.so flyline
flyline run-tutorial

Installation notes

Disable flyline with enable -d flyline.

BASH_LOADABLES_PATH

Taken from https://www.gnu.org/software/bash/manual/bash.html:

The -f option means to load the new builtin command name from shared object filename, on systems that support dynamic loading. If filename does not contain a slash, Bash will use the value of the BASH_LOADABLES_PATH variable as a colon-separated list of directories in which to search for filename. The default for BASH_LOADABLES_PATH is system-dependent, and may include "." to force a search of the current directory.

Bash 4.4 introduced BASH_LOADABLES_PATH Bash 5.2-alpha added a default value for BASH_LOADABLES_PATH. Check your Bash version with: bash --version

So on Bash at least as recent as 5.2, if you install flyline to one of:

  • /opt/local/lib/bash
  • /opt/pkg/lib/bash
  • /usr/lib/bash
  • /usr/local/lib/bash
  • /usr/pkg/lib/bash

Then you can simply run enable flyline.

Configuration

Flyline sets up its own tab completion so you can type flyline in your shell to interactively browse and configure settings. Copy the commands into your .bashrc so they persist.

Explore this README and examples for what you can configure.

Rich prompts

Flyline supports dynamic content in PS1, RPS1 / RPROMPT, PS1_FILL, PROMPT_RULER, and PS2.

PS1

The PS1 environment variable sets the left prompt just like normal. See Bash prompt documentation, Arch Linux wiki, or Starship for more information.

bash
PS1='\\u@\h:\w$ '
PS1='\\u@\h:\w\n$ '
PS1='\e[01;32m\\u@\h\e[00m:\e[01;34m\w\e[00m\n$ '

[!TIP] Do git metrics slow down your prompt loading time? See custom widget or example widgets for a solution.

RPS1 / RPROMPT

The RPS1 / RPROMPT variable sets the right prompt similarly to Zsh.

bash
RPS1='\t'
RPS1='\t\n\e[0m '

# Custom prompt prefix with line numbers
PS2='\e[2mline FLYLINE_PROMPT_LINE_NUMBER:\e[0m '

# If you do want the default '> ' prompt, then you want:
PS2='\e[0m> '

Final (transient) prompts

PS1_FINAL, RPS1_FINAL, PS1_FILL_FINAL, and PROMPT_RULER_FINAL let you configure transient prompts. When a command is submitted, Flyline performs a final redraw using these environment variables instead of their standard counterparts. This keeps your terminal scrollback history clean by replacing complex, multi-line prompts with a minimal version.

bash
PS1_FINAL='Ran at \D{%Y-%m-%d %H:%M:%S}> '
RPS1_FINAL=''
PS1_FILL_FINAL=''
PROMPT_RULER_FINAL=''

Dynamic time in prompts

Flyline recognises the standard Bash time escape sequences and re-evaluates them on every prompt draw, so the time shown is always current:

Sequence Output
\t 24-hour time — HH:MM:SS
\T 12-hour time — HH:MM:SS
\@ 12-hour time with am/pm
\A 24-hour time — HH:MM
\D{format} Custom format (see below)

These can be placed in any of the supported prompt variables:

bash
# Right prompt showing 24-hour time in green
RPS1='\e[01;32m\t\e[0m'

# Right prompt showing 12-hour am/pm time
RPS1='\e[01;34m\@\e[0m'

Custom time format with \D{format}

Use \D{format} with any Chrono format string to display the time exactly how you want it. This is similar to \D{format} in the Bash prompt documentation, but the format string is interpreted by Chrono rather than strftime.

bash
# Show date and time
RPS1='\e[01;32m\D{%Y-%m-%d %H:%M:%S}\e[0m'

# Show only hours and minutes
RPS1='\D{%H:%M}'

Custom prompt widgets

Create custom prompt widgets with flyline create-prompt-widget. Flyline will replace strings in the prompt matching the widget name with the widget's output. The available widget types are animation, mouse-mode, copy-buffer, custom, and last-command-duration.

Animations

Create your own animations with flyline create-prompt-widget animation --name [your animation name here] [FRAMES].... Flyline will replace strings in the prompt matching the animation name with the animation: More examples can be found in examples/animations.sh.

The block below is auto-generated from flyline create-prompt-widget animation --help:

…

Mouse-mode widget

The block below is auto-generated from flyline create-prompt-widget mouse-mode --help:

…

Copy-buffer widget

Render clickable text in your prompt that copies the current command buffer to the clipboard via OSC 52.

bash
flyline create-prompt-widget copy-buffer '[copy]'
# Now use FLYLINE_COPY_BUFFER in your prompt:
RPS1=' FLYLINE_COPY_BUFFER'

Custom command widget

The block below is auto-generated from flyline create-prompt-widget custom --help:

…

Last-command-duration widget

Show how long ago the flyline app last closed. The duration is displayed in a compact human-readable format, for example 9.2s, 1m23s, 1h02m03s, 1d20h43m.

bash
flyline create-prompt-widget last-command-duration
# Now use FLYLINE_LAST_COMMAND_DURATION in your prompt:
RPS1=' FLYLINE_LAST_COMMAND_DURATION'

Agent mode

Flyline can interact with your AI agent to suggest commands. This allows you to write a command in plain English and your agent will convert it into a Bash command: After setting up your agent with flyline, you can pass the buffer to your agent with Alt+Enter or simply Enter when your command starts with your trigger prefix (e.g. ai: list files older than three days).

See the examples for how to set this up. If agent mode is not configured yet, pressing Alt+Enter will prompt flyline to help configure it.

Flyline will syntax highlight the suggested commands and render markdown output.

Mouse support

Click to move your cursor, select suggestions, and hover for tooltips. Flyline must capture mouse events for the entire terminal, which isn't always desirable. For instance, you might want to select text above the current prompt with your mouse.

Flyline offers three mouse modes:

  • disabled: Never capture mouse events
  • simple: Mouse capture is on by default; toggled when Escape is pressed
  • smart (default): Mouse capture is on by default with automatic management: disabled on scroll or when the user clicks above the viewport, re-enabled on any keypress or when focus is regained. You can also toggle it manually with Escape

I'd recommend setting up a mouse mode widget to know when mouse capture is enabled.

Tab completion improvements

Flyline extends Bash's tab completion feature in many ways. Note that you will need to have set up completions in normal Bash first.

Intellisense style auto suggestions

Flyline can automatically start tab completion suggestions as you type. This demo shows auto-started suggestions, confirming a suggestion, dismissing with Escape, and submitting the command. This is similar to inshellisense but uses Bash's completion system and runs in the same process as Bash.

Fuzzy tab completion search

When you're presented with suggestions, you can type to fuzzily search through the list: You can customize the fuzzy matching behavior using the flyline suggestions set-fuzzy-mode command. It accepts three options:

  • all (default): Fuzzy matching is enabled for all completion suggestions.
  • none: Fuzzy matching is disabled entirely (falling back to case-insensitive prefix matching).
  • folder-prefixes: Folders are matched using case-insensitive prefix matching while remaining enabled for regular files and other suggestions.

Fuzzy path completion

The last path segments from the cursor to the end will be fuzzily matched on the directory contents:

Glob & extended glob (extglob) expansion

Flyline automatically previews and expands standard globs (*, ?, [...], [[:digit:]], {a,b}) and Bash extglobs:

  • @(pat1|pat2): Matches exactly one of the given patterns (e.g. ls @(Cargo.*|README*))
  • !(pat1|pat2): Matches anything except the given patterns (e.g. ls !(*.rs))
  • ?(pat1|pat2): Matches zero or one occurrence of the patterns
  • *(pat1|pat2): Matches zero or more occurrences of the patterns
  • +(pat1|pat2): Matches one or more occurrences of the patterns (e.g. ls +([0-9]).txt)
  • Multi-segment directory extglobs: ls src/@(app|grammar)/*.rs

[!TIP] Required Bash Settings:

bash
shopt -s extglob     # Enable extglob patterns

Optional pattern matching settings:

bash
shopt -s nocaseglob  # Match filenames case-insensitively
shopt -s globstar    # Enable recursive ** matching
shopt -s dotglob     # Match hidden files with * and ?

Alias expansion

Aliases are expanded before attempting tab completion so that Bash calls the desired completion function. For instance, if gc aliases to git commit, gc --verbo will work as expected.

Nested command contexts

Flyline supports tab completions inside subshell, command substitution, and process substitution expressio

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustbashbash-pluginline-editorrust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具