{"id":13607160,"url":"https://github.com/liamg/bearings","last_synced_at":"2025-08-20T03:31:51.738Z","repository":{"id":42977676,"uuid":"466257532","full_name":"liamg/bearings","owner":"liamg","description":":compass: A fast, clean, customisable shell prompt for zsh, bash, fish, and more...","archived":false,"fork":false,"pushed_at":"2022-07-20T21:22:09.000Z","size":152,"stargazers_count":199,"open_issues_count":1,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-07T00:41:08.477Z","etag":null,"topics":["bash","fish","powerline","prompt","shell-prompt","zsh"],"latest_commit_sha":null,"homepage":"","language":"Go","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/liamg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["liamg"]}},"created_at":"2022-03-04T20:11:36.000Z","updated_at":"2024-10-27T23:27:00.000Z","dependencies_parsed_at":"2022-09-12T07:20:33.906Z","dependency_job_id":null,"html_url":"https://github.com/liamg/bearings","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fbearings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fbearings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fbearings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fbearings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liamg","download_url":"https://codeload.github.com/liamg/bearings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230388131,"owners_count":18217755,"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","fish","powerline","prompt","shell-prompt","zsh"],"created_at":"2024-08-01T19:01:16.075Z","updated_at":"2024-12-19T06:10:04.258Z","avatar_url":"https://github.com/liamg.png","language":"Go","readme":"# :compass: bearings\n\nA fast, clean, super-customisable shell prompt.\n\n- Supports zsh, bash, fish, and more.\n- Easily write your own modules using any language.\n- Simple configuration with YAML - works out of the box with a sensible default configuration too.\n\n## Examples Gallery\n\n\u003ctable\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/default/screenshot.png\"  alt=\"prompt demo\"/\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/default/config.yml\"\u003eDefault\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/halflife/screenshot.png\" alt=\"prompt demo\"/\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/halflife/config.yml\"\u003eHalf Life\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/traditional/screenshot.png\" alt=\"prompt demo\" /\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/traditional/config.yml\"\u003eTraditional\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/fire/screenshot.png\" alt=\"prompt demo\"/\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/fire/config.yml\"\u003eFire\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/ukraine/screenshot.png\" alt=\"prompt demo\"/\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/ukraine/config.yml\"\u003eUkraine\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/pirate/screenshot.png\" alt=\"prompt demo\"/\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/pirate/config.yml\"\u003ePirate\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/wasteland/screenshot.png\" alt=\"prompt demo\"/\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/wasteland/config.yml\"\u003eWasteland\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cimg src=\"_examples/hive/screenshot.png\" alt=\"prompt demo\"/\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"_examples/hive/config.yml\"\u003eHive\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n_Feel free to PR your own screenshots onto this list!_\n\n## Installation\n\nYou can download the latest binaries [here](https://github.com/liamg/bearings/releases/latest). Make sure you `chmod +x`  the binary and place it somewhere in your `PATH`. Then follow the instructions for your shell below.\n\nIt is recommended to install font(s) which include powerline characters, especially [nerd-fonts](https://github.com/ryanoasis/nerd-fonts).\n\n## Configuration\n\n### Automatic (recommended)\n\nYou can automatically configure your shell by running `bearings install`. This will modify your shell configuration files in order to set bearings as your PS1 generator. For advanced configurations (e.g. templated dotfiles), you should use the manual methods below. It's always a good idea to back up your config files first!\n\nIf you'd like to install bearings to a shell other than the one you're using, you can specify it with the `-s/--shell` flag, e.g. `bearings install -s fish`.\n\n### ZSH\n\n```zsh\n#bearings-auto:start\nfunction preexec() {\n  if [[ $OSTYPE == 'darwin'* ]]; then\n    btimer=$(($(date +%s)*1000))\n  else\n    btimer=$(($(date +%s%N)/1000000))\n  fi\n}\nfunction configure_bearings() {\n    last=$?\n    elapsed=0\n    if [ $btimer ]; then\n      if [[ $OSTYPE == 'darwin'* ]]; then\n        now=$(($(date +%s)*1000))\n      else\n        now=$(($(date +%s%N)/1000000))\n      fi\n      elapsed=$(($now-$btimer))\n      unset btimer\n    fi\n    PROMPT=\"$(bearings prompt -s zsh -e ${last} -d ${elapsed} -j $(jobs | wc -l))\"\n}\n[ ! \"$TERM\" = \"linux\" ] \u0026\u0026 precmd_functions+=(configure_bearings)\n#bearings-auto:end\n```\n\n### Bash\n\n```bash\n#bearings-auto:start\nif [[ $OSTYPE == 'darwin'* ]]; then\n    PS0='$(echo \"$(($(date +%s)*1000))\" \u003e /tmp/bearings.$$)';\nelse\n    PS0='$(echo \"$(($(date +%s%N)/1000000))\" \u003e /tmp/bearings.$$)';\nfi\nbearings_prompt() { \n    if [[ $OSTYPE == 'darwin'* ]]; then\n        NOW=$(($(date +%s)*1000))\n    else\n        NOW=$(($(date +%s%N)/1000000))\n    fi\n    START=$NOW\n    [[ -f /tmp/bearings.$$ ]] \u0026\u0026 START=$(cat /tmp/bearings.$$) \u0026\u0026 rm /tmp/bearings.$$\n    DURATION=$(($NOW - $START));\n    export PS1=$(bearings prompt -s bash -e $? -d $DURATION -j $(jobs -p | wc -l)); \n}\n[[ ! \"$TERM\" = \"linux\" ]] \u0026\u0026 export PROMPT_COMMAND=bearings_prompt\n#bearings-auto:end\n```\n\n### Fish\n\n```fish\n#bearings-auto:start\nfunction fish_prompt\n    bearings prompt -s fish -e $status -d $CMD_DURATION -j (count (jobs -p))\nend\n#bearings-auto:end\n```\n\n## Customisation\n\nThe config file is read from `~/.config/bearings/config.yml`. You can create a default config file by running `bearings prompt` for the first time.\n\nFor completeness, here is the default config file:\n\n```yaml\npadding: 1\nend: \ndivider: \nfg: white\nbg: black\nlines_above: 1\nmodules:\n- type: exitcode\n  failure_bg: '#bb4444'\n  failure_fg: '#ffffff'\n  show_success: true\n  success_bg: '#000000'\n  success_fg: '#ffffff'\n  success_output: \n- type: duration\n  bg: '#ffffff'\n  fg: '#334488'\n  threshold: 3s\n- type: cwd\n  bg: '#334488'\n  fg: '#aaaaaa'\n  label:  %s\n  max_depth: 3\n- type: git\n  bg: '#393939'\n  fg: '#777777'\n```\n\nYou can find example configurations with screenshots for each in the [examples directory](_examples).\n\n| Property    | Default                 | Description                                                                            |\n|-------------|-------------------------|----------------------------------------------------------------------------------------|\n| padding     | 1                       | Number of spaces before and after each module. Can be overriden on a per-module basis. |\n| end         |  (powerline character) | The string to render at the end (right) of the prompt.                                 |\n| divider     |  (powerline character) | The string to render between modules. Can be overriden on a per-module basis.          |\n| fg          | white                   | Default foreground colour for all modules. Can be overridden on a per-module basis.    |\n| bg          | black                   | Default background colour for all modules. Can be overridden on a per-module basis.    |\n| lines_above | 1                       | Number of blank lines to render above the prompt.                                      |\n| modules     | exitcode, cwd, git      | A list of modules and their configurations.                                            |\n\nColours can be specified in hexadecimal, e.g. `#ffffff`. You can also refer to your terminal colour scheme colours using `default` (for default fg/bg), `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `black`, `lightred`, `lightgreen`, `lightyellow`, `lightblue`, `lightmagenta`, `lightcyan`, `lightwhite`, `lightblack`\n\nAll modules support the following options:\n\n| Property       | Default                           | Description                                                                                                                    |\n|----------------|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| label          | %s                                | Text to render alongside the module output. Use %s as the placeholder for the module content.                                  |\n| fg             | _inherits from top-level fg_      | Module foreground colour.                                                                                                      |\n| bg             | _inherits from top-level bg_      | Module background colour.                                                                                                      |\n| padding_before | _inherits from top-level padding_ | Number of spaces to output before the module content.                                                                          |\n| padding_after  | _inherits from top-level padding_ | Number of spaces to output after the module content.                                                                           |\n| divider        | _inherits from top-level divider_ | Divider string to output after the module, to separate it fro mthe next module. If there is no next module, will not be shown. |\n | bold           | false                             | Turns on bold text.                                                                                                            |\n| italic         | false                             | Turns on italic text.                                                                                                          |\n| faint          | false                             | Turns on faint text.                                                                                                           |\n| underline      | false                             | Turns on underlined text.                                                                                                      |\n\n## Available Modules\n\n### Current Working Directory (`cwd`)\n\nShow the current working directory.\n\n![cwd](_assets/cwd.png)\n\n| Property           | Default                   | Description                                                                                                                                                                               |\n|--------------------|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| max_depth          | 0                         | The maximum number of directories to render in the path. If this number is exceeded, the output will be truncated to show `...` followed by the lowest `max_depth` number of directories. |\n| separator          |                          | The string to separate directories with.                                                                                                                                                  |\n | separator_fg       | _inherits from module fg_ | Foreground colour of the separator.                                                                                                                                                       |\n | deep_prefix        |                          | Output to prefix the path with when the max depth is reached.                                                                                                                             |\n | home_text          | ~                         | Text to represent home directory.                                                                                                                                                         |\n | separator_at_start | false                     | Show the separator at the start of the path.                                                                                                                                              |\n\n### Exit Code (`exitcode`)\n\nShow the exit code of the previous command. By default will only show when the command fails, but can also show a success icon/message.\n\n![exit code](_assets/exitcode.png)\n\n| Property       | Default                          | Description                                                            |\n|----------------|----------------------------------|------------------------------------------------------------------------|\n| show_success   | false                            | Show the module when the previous command succeeded (exit code zero).  |\n| success_bg     | _inherits from bg, top-level bg_ | Background colour for the module when the previous command succeeded.  |\n| failure_bg     | _inherits from bg, top-level bg_ | Background colour for the module when the previous command failed.     |\n| success_fg     | green                            | Foreaground colour for the module when the previous command succeeded. |\n| failure_fg     | red                              | Foreground colour for the module when the previous command failed.     |\n| success_output |                                 | Output for the module when the previous command succeeded.             |\n| failure_output |                                 | Output for the module when the previous command failed.                |\n\n### Git Overview (`git`)\n\nShow an overview of the current git status. Displays the branch name, a set of possible icons, and the number of commits ahead/behind of the base branch.\n\n| Property       | Default   | Description                                                  |\n|----------------|-----------|--------------------------------------------------------------|\n| icon_stashed   | S         | The icon/text to display when stashed changes are available. |\n| icon_untracked | ?         | The icon/text to display when untracked files are present.   |\n| icon_modified  | M         | The icon/text to display when tracked files are modified.    |\n| icon_staged    | A         | The icon/text to display when changes are staged.            |\n| icon_conflicts | !         | The icon/text to display when conflicts are present.         |\n| clean_bg       | _inherit_ | Background colour when there are no changes.                 |\n| clean_fg       | _inherit_ | Foreground colour when there are no changes.                 |\n| dirty_bg       | _inherit_ | Background colour when there are changes.                    |\n| dirty_fg       | _inherit_ | Foreground colour when there are changes.                    |\n\n### Command (`command`)\n\nRun a shell command and use the combined output streams as the module output.\n\n| Property | Default | Description               |\n|----------|---------|---------------------------|\n| command  | _none_  | The shell command to run. |\n\n### Duration\n\nShows the duration of the previous shell command. Can be configured to only show duration when over a certain threshold.\n\n![Duration example](_assets/duration.png)\n\n| Property  | Default | Description                             |\n|-----------|---------|-----------------------------------------|\n| threshold | 3s      | Show duration when over this threshold. |\n\n### Jobs\n\nShows the number of background jobs (if \u003e 0).\n\n### Hostname (`hostname`)\n\nShow the current hostname.\n\n### Languages\n\nShow icons for discovered languages/technologies in the current directory.\n\n| Property  | Default | Description                      |\n|-----------|---------|----------------------------------|\n| separator | \u003cspace\u003e | The separator between the icons. |\n\n### New line (`newline`)\n\nOutput a single new line. Before/after padding values default to `0` for convenience.\n\n### Text (`text`)\n\nOutput the specified text.\n\n| Property | Default | Description         |\n|----------|---------|---------------------|\n| text     | _none_  | The text to output. |\n\n### Username (`username`)\n\nShow the current username.\n","funding_links":["https://github.com/sponsors/liamg"],"categories":["Themes","Go","Shells"],"sub_categories":["ZSH on Windows","Prompts"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamg%2Fbearings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliamg%2Fbearings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamg%2Fbearings/lists"}