{"id":13897804,"url":"https://github.com/bluz71/bash-seafly-prompt","last_synced_at":"2025-10-04T21:29:23.775Z","repository":{"id":68006553,"uuid":"162853758","full_name":"bluz71/bash-seafly-prompt","owner":"bluz71","description":"A clean and fast Bash prompt","archived":false,"fork":false,"pushed_at":"2025-04-01T06:30:47.000Z","size":162,"stargazers_count":47,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T07:33:47.761Z","etag":null,"topics":["bash","prompt","shell-prompt","shell-theme"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluz71.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"bluz71"}},"created_at":"2018-12-23T01:23:27.000Z","updated_at":"2025-04-01T06:30:50.000Z","dependencies_parsed_at":"2025-04-01T07:27:13.808Z","dependency_job_id":"cdbe4eb7-7120-45b8-8f03-e4550f5dda6e","html_url":"https://github.com/bluz71/bash-seafly-prompt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fbash-seafly-prompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fbash-seafly-prompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fbash-seafly-prompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fbash-seafly-prompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluz71","download_url":"https://codeload.github.com/bluz71/bash-seafly-prompt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251025609,"owners_count":21524830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","prompt","shell-prompt","shell-theme"],"created_at":"2024-08-06T18:03:53.064Z","updated_at":"2025-10-04T21:29:18.727Z","avatar_url":"https://github.com/bluz71.png","language":"Shell","funding_links":["https://ko-fi.com/bluz71"],"categories":["Shell"],"sub_categories":[],"readme":"![seafly](https://raw.githubusercontent.com/bluz71/misc-binaries/master/headings/seafly.png)\n========\n\n_seafly_ is a clean and fast command prompt for the\n[Bash](https://www.gnu.org/software/bash) shell heavily inspired by the [Pure\nZSH](https://github.com/sindresorhus/pure) prompt.\n\n:rocket: For maximum repository performance, _seafly_ will use, if available,\neither the [git-status-fly](https://github.com/bluz71/git-status-fly) or\n[git-status-snap](https://github.com/bluz71/git-status-snap) utilities. Note, it\nis strongly recommened to use either of these utilities to accelerate prompt\nperformance.\n\nScreenshot\n----------\n\n\u003cimg width=\"800\" alt=\"seafly\" src=\"https://raw.githubusercontent.com/bluz71/misc-binaries/master/seafly/seafly.png\"\u003e\n\nThe font in use is [Iosevka](https://github.com/be5invis/Iosevka).\n\nLayout\n------\n\n_seafly_ is a prompt that displays the following segments when using the\ndefault layout:\n\n```\n\u003cOptional Prefix\u003e \u003cOptional User/Host\u003e \u003cCurrent Path\u003e \u003cGit Branch\u003e \u003cGit Indicators\u003e \u003cPrompt Symbol\u003e\n```\n\nNote, when `SEAFLY_LAYOUT=2` is set the prompt will instead display as:\n\n```\n\u003cOptional Prefix\u003e \u003cOptional User/Host\u003e \u003cGit Branch\u003e \u003cGit Indicators\u003e \u003cCurrent Path\u003e \u003cPrompt Symbol\u003e\n```\n\n_seafly_ can also display as a multiline prompt when `SEAFLY_MULTILINE=1` is\nset. The layout will be the same as listed above but with additional newlines\nprior to the prefix and prompt symbol.\n\nPlease refer to the configuration section below for more details.\n\nBehaviour\n---------\n\n- When in a Git repository the checked out Git branch will be displayed.\n\n- When in a Git repository, dirty state, upstream and stash indicators will be\n  displayed. Note, these can individually be disabled if desired.\n\n- The prompt symbol will change to an alert color, by default red, if the last\n  command did not execute successfully.\n\nVisuals\n-------\n\n_seafly_ by default will use Unicode characters for the prompt symbol and\ncertain Git indicators. These symbols will display correctly when using a modern\nfont such as [Iosevka](https://github.com/be5invis/Iosevka).\n\nAlso, _seafly_ by default will use colors that favour a dark background.\n\nBoth the symbols and colors used by _seafly_ can be overridden, please refer to\nthe configuration section below. As an example, the following configuration\nwill:\n\n-   only use ASCII characters\n-   use colors appropriate for a light terminal theme\n-   style the Git section to mimic `$(__git_ps1)` provided by the\n    [`git-prompt.sh` script](https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh)\n    that ships with Git\n\n```sh\nSEAFLY_PROMPT_SYMBOL=\"\u003e\"\nSEAFLY_PS2_PROMPT_SYMBOL=\"\u003e\"\nSEAFLY_GIT_PREFIX=\"(\"\nSEAFLY_GIT_SUFFIX=\")\"\nSEAFLY_GIT_DIRTY=\"*\"\nSEAFLY_GIT_STASH=\"$\"\nSEAFLY_GIT_AHEAD=\"\u003e\"\nSEAFLY_GIT_BEHIND=\"\u003c\"\nSEAFLY_GIT_DIVERGED=\"\u003c\u003e\"\nSEAFLY_SUCCESS_COLOR=\"$(tput setaf 63)\"\nSEAFLY_ALERT_COLOR=\"$(tput setaf 202)\"\nSEAFLY_HOST_COLOR=\"$(tput setaf 242)\"\nSEAFLY_GIT_COLOR=\"$(tput setaf 99)\"\nSEAFLY_PATH_COLOR=\"$(tput setaf 70)\"\n. ~/.bash-seafly-prompt/command_prompt.bash\n```\n\nRequirements\n------------\n\nA modern 256 or true color terminal is required.\n\nPlease also make sure the `TERM` environment variable is set to\n`xterm-256color`, `screen-256color` or equivalent terminal setting.\n\nFor example setting `TERM` to `xterm-256color` is usually done at the terminal\nlevel either in a preferences dialog or a related configuration file, if\nrequired at all. Note, some modern terminals will automatically set 256 colors\nby default, for example, modern versions of [Gnome\nTerminal](https://wiki.gnome.org/Apps/Terminal).\n\nSetting `TERM` to `screen-256color` should only be done for\n[tmux](https://github.com/tmux/tmux/wiki) sessions. If you are a tmux user then\nplease add the following to your `~/.tmux.conf` file:\n\n```\nset -g default-terminal \"screen-256color\"\nset -ga terminal-overrides ',xterm-256color:Tc'\n```\n\nNote, modern terminals such as [Alacritty](https://github.com/alacritty) and\n[kitty](https://sw.kovidgoyal.net/kitty) provide their own terminfo definitions\nwhich are also supported by _seafly_ prompt.\n\nInstallation\n------------\n\nInstall the _seafly_ prompt script:\n\n```sh\ngit clone --depth 1 https://github.com/bluz71/bash-seafly-prompt ~/.bash-seafly-prompt\n```\n\nSource the _seafly_ prompt script in your `~/.bashrc` file:\n\n```sh\n. ~/.bash-seafly-prompt/command_prompt.bash\n```\n\nNote, to update to the latest version of _seafly_:\n\n```sh\ncd ~/.bash-seafly-prompt\ngit pull\n```\n\ngit-status-fly\n--------------\n\nThe [git-status-fly](https://github.com/bluz71/git-status-fly) utility is a\nsimple [Rust](https://www.rust-lang.org) implemented `git status` parser.\nProcessing the output of `git status` using shell commands, such as `grep` and\n`awk`, is much slower than using an optimized binary such as _git-status-fly_.\n\nInstall the _git-status-fly_ somewhere in the current `$PATH`.\n\ngit-status-snap\n--------------\n\nThe [git-status-snap](https://github.com/bluz71/git-status-snap) utility is an\nalternative [Crystal](https://crystal-lang.org) implemented `git status` parser.\nImplementation and behaviour is the same as _git-status-fly_.\n\nInstall the _git-status-snap_ somewhere in the current `$PATH`.\n\nGit Performance\n---------------\n\n_seafly_ provides two ways to gather Git status, the previously mentioned\n_git-status-fly_ or _git-status-snap_ utilities, or a fallback method which\ncollates details using just the `git` command.\n\nWhich to use? See the following performance results and decide.\n\nPerformance metrics are listed for the following four repositories:\n\n- _dotfiles_, small repository with 189 managed files\n- _rails_, medium repository with 4,574 managed files\n- _linux_, large repository with 79,878 managed files\n- _chromium_, extra large repository with 413,542 managed files\n\nListed is the average time to compute the prompt function.\n\nLinux desktop with NVMe storage:\n\n| Repository     | `git-status-fly` | `git-status-snap` | `git` fallback |\n|----------------|------------------|-------------------|----------------|\n| _dotfiles_     | `5ms`            | `6ms`             | `11ms`         |\n| _rails_        | `7ms`            | `7ms`             | `14ms`         |\n| _linux_(*)     | `26ms`           | `26ms`            | `38ms`         |\n| _chromium_ (*) | `122ms`          | `123ms`           | `154ms`        |\n\nM1 Macbook Air:\n\n| Repository     | `git-status-fly` | `git-status-snap` | `git` fallback |\n|----------------|------------------|-------------------|----------------|\n| _dotfiles_     | `33ms`           | `39ms`            | `61ms`         |\n| _rails_        | `39ms`           | `43ms`            | `73ms`         |\n| _linux_ (!)    | `60ms`           | `64ms`            | `105ms`        |\n| _chromium_ (!) | `103ms`          | `108ms`           | `155ms`        |\n\n- **(*)**, the `git config feature.manyFiles true` option was enabled  as\n  [documented here](https://github.blog/2019-11-03-highlights-from-git-2-24/)\n\n- **(!)**, in addition to enabling `manyFiles`, the `git config core.fsmonitor\n  true` file system monitor was also enabled as [documented\n  here](https://github.blog/2022-06-29-improve-git-monorepo-performance-with-a-file-system-monitor)\n\nNote, as of May 2023 `fsmonitor` is implemented only for Windows and macOS, it\nis not available for Linux.\n\nIn practise, a prompt startup time under 40ms feels instant.\n\nConfiguration\n-------------\n\nCertain behaviours and visuals of the _seafly_ prompt can be controlled\nthrough environment variables.\n\nNote, a dash character denotes an unset default value.\n\n### Environment Variables\n\n| Option                               | Description                                                                                                                               | Default Value |\n| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------| ------------- |\n| **`SEAFLY_LAYOUT`**                  | Specify the preferred layout.\u003cbr\u003eLayout `1` will display path followed Git details.\u003cbr\u003eLayout `2` will flip the path and Git details.     | 1             |\n| **`SEAFLY_MULTILINE`**               | Specify multiline layout.\u003cbr\u003e`SEAFLY_MULTILINE=1` will display the prompt over multiple lines.                                            | 0             |\n| **`SEAFLY_SHOW_USER`**               | Display the current user in the user/host segment.\u003cbr\u003eSet to `1` to display the user.\u003cbr\u003eRefer to `SEAFLY_SHOW_USERHOST_CONNECTED`.       | 0             |\n| **`SEAFLY_SHOW_HOST`**               | Display the current hostname in the user/host segment.\u003cbr\u003eSet to `0` to not display the host.\u003cbr\u003eRef to `SEAFLY_SHOW_USERHOST_CONNECTED`. | 1             |\n| **`SEAFLY_SHOW_USERHOST_CONNECTED`** | Display the user/host segment only when connected to external hosts.\u003cbr\u003eSet to `0` to always the user/host segment.                       | 1             |\n| **`PROMPT_DIRTRIM`**                 | Shorten the current directory path to a set maximum number of components.\u003cbr\u003eSet to `0` to not shorten the current path.                  | 4             |\n| **`GIT_PS1_SHOWDIRTYSTATE`**         | Indicate the presence of Git modifications.\u003cbr\u003eSet to `0` to skip.                                                                        | 1             |\n| **`GIT_PS1_SHOWSTASHSTATE`**         | Indicate the presence of Git stashes.\u003cbr\u003eSet to `0` to skip.                                                                              | 1             |\n| **`GIT_PS1_SHOWUPSTREAM`**           | Indicate differences exist between HEAD and upstream in a Git remote-tracking branch.\u003cbr\u003eSet to `0` to skip.                              | 1             |\n\n### Hooks\n\n| Hook                             | Description                                                                                                 | Default Value |\n| ---------------------------------| ------------------------------------------------------------------------------------------------------------| ------------- |\n| **`seafly_pre_command_hook`**    | A function hook to run each time the prompt is displayed.\u003cbr\u003ePlease make sure the hook is fast.             | -             |\n| **`seafly_prompt_prefix_hook`**  | A function hook to populate the _optional prefix_ segment.\u003cbr\u003ePlease make sure the hook is simple and fast. | -             |\n\n- A **`pre_command_hook`** example that appends and updates history each time\n  the prompt is executed:\n\n  ```bash\n  seafly_pre_command_hook=\"seafly_pre_command\"\n\n  seafly_pre_command() {\n      history -a \u0026\u0026 history -n\n  }\n  ```\n\n- A **`prompt_prefix_hook`** example that displays the current Node version if\n  `package.json` file is present or displays the name of the current Python\n  virtual environment if one is active in the _optional prefix_ segment:\n\n  ```bash\n  seafly_prompt_prefix_hook=\"seafly_prompt_prefix\"\n\n  seafly_prompt_prefix() {\n      if [[ -f package.json ]]; then\n          echo \"($(nvm current))\"\n      elif [[ -n $VIRTUAL_ENV ]]; then\n          echo \"($(basename $VIRTUAL_ENV))\"\n      fi\n  }\n  ```\n\n### Symbols\n\n| Option                         | Description                                                                           | Default Value |\n| ------------------------------ | ------------------------------------------------------------------------------------- | ------------- |\n| **`SEAFLY_PROMPT_SYMBOL`**     | The prompt symbol                                                                     | ❯             |\n| **`SEAFLY_PS2_PROMPT_SYMBOL`** | The `PS2` secondary prompt symbol                                                     | ❯             |\n| **`SEAFLY_GIT_PREFIX`**        | Symbol to the left of the Git branch                                                  |              |\n| **`SEAFLY_GIT_SUFFIX`**        | Symbol to the right of the Git indicators                                             | -             |\n| **`SEAFLY_GIT_DIRTY`**         | Symbol indicating that a Git repository contains modifications                        | ✗             |\n| **`SEAFLY_GIT_STAGED`**        | Symbol indicating that a Git repository contains staged changes                       | ✓             |\n| **`SEAFLY_GIT_STASH`**         | Symbol indicating that a Git repository contains one or more stashes                  | ⚑             |\n| **`SEAFLY_GIT_AHEAD`**         | Symbol indicating that a Git remote-tracking branch is ahead of upstream              | ↑             |\n| **`SEAFLY_GIT_BEHIND`**        | Symbol indicating that a Git remote-tracking branch is behind upstream                | ↓             |\n| **`SEAFLY_GIT_DIVERGED`**      | Symbol indicating that a Git remote-tracking branch is both ahead and behind upstream | ↕             |\n\n### Colors\n\nThe default color values listed below, such as `111` and `203`, derive from\nxterm 256 color values. Please refer to [this\nchart](https://jonasjacek.github.io/colors) when customizing _seafly_ colors.\n\n| Option                     | Description                                  | Default Value | Color                                             |\n| -------------------------- | -------------------------------------------- | ------------- | ------------------------------------------------- |\n| **`SEAFLY_PREFIX_COLOR`**  | _Optional prefix_ segment                    | `217`         | ![normal](https://place-hold.it/32/5fd7af?text=+) |\n| **`SEAFLY_SUCCESS_COLOR`** | Standard prompt and certain Git indicators   | `111`         | ![normal](https://place-hold.it/32/87afff?text=+) |\n| **`SEAFLY_ALERT_COLOR`**   | Alert prompt and Git dirty indicator         | `203`         | ![normal](https://place-hold.it/32/ff5f5f?text=+) |\n| **`SEAFLY_HOST_COLOR`**    | Host segment                                 | `255`         | ![normal](https://place-hold.it/32/eeeeee?text=+) |\n| **`SEAFLY_GIT_COLOR`**     | Git branch, stash and optional prefix/suffix | `147`         | ![normal](https://place-hold.it/32/afafff?text=+) |\n| **`SEAFLY_PATH_COLOR`**    | Current directory path                       | `114`         | ![normal](https://place-hold.it/32/87d787?text=+) |\n\nSponsor\n-------\n\n[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/bluz71)\n\nLicense\n-------\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluz71%2Fbash-seafly-prompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluz71%2Fbash-seafly-prompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluz71%2Fbash-seafly-prompt/lists"}