{"id":15209501,"url":"https://github.com/nonlogicaldev/shell.async-goprompt","last_synced_at":"2025-10-29T15:30:37.419Z","repository":{"id":49802931,"uuid":"518156355","full_name":"NonLogicalDev/shell.async-goprompt","owner":"NonLogicalDev","description":"⚡️ ZSH Non Blocking Prompt based on ZLE File Descriptor Handler ⚡️","archived":false,"fork":false,"pushed_at":"2024-08-21T19:04:49.000Z","size":3525,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-08T18:54:00.869Z","etag":null,"topics":["async","golang","prompt","zle","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/NonLogicalDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2022-07-26T17:28:48.000Z","updated_at":"2024-10-24T11:30:02.000Z","dependencies_parsed_at":"2023-11-19T00:27:46.497Z","dependency_job_id":"7214ddb8-3ba4-4b2e-89fb-6e925e9c5915","html_url":"https://github.com/NonLogicalDev/shell.async-goprompt","commit_stats":{"total_commits":28,"total_committers":2,"mean_commits":14.0,"dds":0.3214285714285714,"last_synced_commit":"825f496681b5ba1d08c6cb39b74d8b53a081624f"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NonLogicalDev%2Fshell.async-goprompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NonLogicalDev%2Fshell.async-goprompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NonLogicalDev%2Fshell.async-goprompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NonLogicalDev%2Fshell.async-goprompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NonLogicalDev","download_url":"https://codeload.github.com/NonLogicalDev/shell.async-goprompt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238840731,"owners_count":19539602,"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":["async","golang","prompt","zle","zsh"],"created_at":"2024-09-28T07:40:28.775Z","updated_at":"2025-10-29T15:30:37.413Z","avatar_url":"https://github.com/NonLogicalDev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Not Your Average Async ZSH/FISH Shell Prompt\n\n\u003ccenter\u003e\n\n![Project Logo](./assets/logo_w1000.png)\n\n\u003c/center\u003e\n\nInspired by:\n* https://github.com/nbari/slick\n* https://github.com/ericfreese/zsh-efgit-prompt\n* https://github.com/acomagu/fish-async-prompt/blob/master/conf.d/__async_prompt.fish\n* https://github.com/jorgebucaran/hydro/blob/main/conf.d/hydro.fish\n\n* By the idea that Prompt Should NOT introduce any LAG\n* By the pain of working in a gargantous monorepo where `git status` used to take over `10` seconds to run.\n\n\n## Selling Points:\n\n* Packs some punch, with lightning speed never seen before!\n* This prompt is truly **⚡️ INSTA ⚡️**, as fast as no prompt at all.\n* Zero lag between pressing enter and being able to type your next command.\n* Truly and faithfully asynchronous, can cope with most bloated Git monorepos out there without introducing lag.\n\t* This was the first and foremost requirement\n* Pretty much the only prompt out there with native support for **VCS: Stacked Git** and **VCS: Sappling**.\n* Pretty much the only prompt out there to use ZLE File Descriptor for async work.\n\n![Demo Of GoPrompt With ZLE (ZSH)](./assets/Kapture%202022-07-26%20at%2010.45.33.gif \"Capture\")\n\nGoPrompt is lightning fast, and truly and faithfully asynchronous prompt based on ZLE File Descriptor co-routines, with default theme/query implementation in a very simple to extend GoLang package.\n\n## Quick Install\n\nThe latest releases are available under:\n\nhttps://github.com/NonLogicalDev/shell.async-goprompt/releases/latest\n\nInstall latest using:\n\n```sh\ncurl -sfL https://raw.githubusercontent.com/NonLogicalDev/shell.async-goprompt/main/install.sh | bash -\n```\n\nThis will install `goprompt` under `~/.local/bin`. Please ensure that it is in your `$PATH`.\n\nAlternatively if you have `GoLang` installed you can install it directly from source:\n\n```\ngo install github.com/NonLogicalDev/shell.async-goprompt/cmd/goprompt@latest\n```\n\nAnd if you want to build it yourself and/or contribute, feel free to checkout [#Build Instructions](#build-instructions) section below, for guidance on how to build it from source locally.\n\n## Install Into Shell (ZSH)\n\nTry for one session:\n```sh\n$ eval \"$(goprompt install zsh)\"\n```\n\nInstall permanently:\n```sh\n$ goprompt install zsh \u003e\u003e ~/.zshrc\n```\n\n## Install Into Shell (FISH)\n\nTry for one session:\n```sh\n$ eval \"$(goprompt install fish)\"\n```\n\nInstall permanently:\n```sh\n$ goprompt install fish \u003e\u003e ~/.config/fish/conf.d/50-goprompt.fish\n```\n\n## Default Renderer supports:\n\n### Example:\n\n```sh\n# After running this:\n\n\t$ ( sleep 570; exit 130 )\n\n# Example prompt with most integrations displayed:\n\n\t:: {git:main:\u0026:[+1:-0]} {stg:readme:1/2}\n\t:: [130] (vifm) (~/U/P/shell.async-goprompt) 9m30s [22:18:42 02/20/23]\n\t\u003e\n\n# After normal (faster, errorless) execution:\n\n\t:: {git:main:\u0026:[+1:-0]} {stg:readme:1/2}\n\t:: (vifm) (~/U/P/shell.async-goprompt) [22:18:42 02/20/23]\n\t\u003e\n\n# When outside of VCS root:\n\n\t:: ------------------------------\n\t:: (vifm) (~/U/Projects) [22:18:42 02/20/23]\n\t\u003e\n\n```\n\n### Features:\n\n* Ascii-only but still pretty\n\t* Because there are so many bad terminal emulators out there.\n\n* `Pure`-like:\n\t* Truncated Current Path Display (`~/U/P/shell.async-goprompt`)\n\t* last command duration (`9m30s`)\n\t* last command exit status (`[130]`)\n\t\t* makes debugging shell scripts and `test` commands that much easier\n\t* Vim Mode indicator support\n\t\t* (`\u003e`) - default (insert mode)\n\t\t* (`\u003c`) - normal (command edit mode)\n\t* SSH / Remote process detection\n\n* Prompt Query State:\n\t* (`:?`) Prompt Query Ongoing\n\t* (`::`) Prompt Query Finished\n\t* (`:x`) Prompt Query Timeout or Failed\n\n* Current Date Display (`[22:00:18 02/20/23]`)\n* Parent Process name (to see when you are in a nested session like in VIFM) (`(vifm)`)\n\n* VCS: Git (`{git:main:\u0026:[+1:-0]}`)\n\t* **[works fast even in a gigantic sluggish monorepo]**\n\t* Current Branch (`main`)\n\t* Index/Worktree Dirty Status (`\u0026`)\n\t* Rebase Detection (`:rebase`)\n\t* Lag Behind Remote (`[+1:-0]`)\n\t\t* Number of unpublished commits (`+1`)\n\t\t* Number of new remote commits (`-0`)\n\n* VCS: Git+Stacked Git (`{stg:readme:1/2}`)\n\t* Current Patch (`readme`)\n\t* Patch stack size and location in the stack (`1/2`)\n\t* Metadata out of sync alert (`stg` badge will turn red)\n\n* VCS: Sappling (new VCS from Facebook) (`{spl:feature1:\u0026}`)\n\t* Current Active Bookmark (`feature1`)\n\t* Worktree Dirty status (`\u0026`)\n\n## Technology / Implementation Details\n\nThis is a non-blocking asynchronous prompt based on ZLE File Descriptor Handlers.\n\nThe prompt query and rendering can be done via any command as long as it follows a line delimited protocol to communicate between the query and rendering components.\n\n### Protocol\n\nThe `query` command output must adhere to a line protocol to be effective in making use of ZLE File Descriptor handler.\n\nThe protocol used in my Async ZLE Implementation is dead simple and easy to implement and use. (So easy it initially was fully implemented in a ZSH script)\n\nFirst of all the protocol is **new line** and **tab** delimited, where each line takes the following form:\n```\n$KEY1\u003ctab char\u003e$VALUE1\n$KEY2\u003ctab char\u003e$VALUE2\n```\n\nThis makes key parsing dead simple and allows values to be as complex as desired (so long as they dont contain new lines), for example they can be single line encoded JSON values.\n\nEach empty line triggers a prompt refresh, kind of like a `sync` singal.\n```\n$KEY1\u003ctab char\u003e$VALUE1\n$KEY2\u003ctab char\u003e$VALUE2\n\u003cempty\u003e\n$KEY3\u003ctab char\u003e$VALUE3\n$KEY4\u003ctab char\u003e$VALUE4\n```\n\n\nThis allows the prompt to periodically communicate that batch of data is ready. Being judicious in not sending `sync` signals leads to less visual jitter when prompt re-renders, in response to updated data.\n\nUpon every `sync` signal renderer gets a newline concatentated list of Key Value Lines on its `STDIN`, and produces the actual prompt.\n\n### Renderer\n\nThe only protocol on the renderer is that Renderer is expected to produce ZSH formatted prompt string base on newline delimited list of key values.\n\nOverall the renderer is a bit like a pure `React` component `render` function.\n\n## Reference\n\nYou can find the ZSH/ZLE integration in:\n\n* [prompt_asynczle_setup.zsh](./plugin/zsh/prompt_asynczle_setup.zsh)\n\nAnd the main query/rendering logic is implemented in GO\n\n* [goprompt](./cmd/goprompt)\n\n## Build Instructions\n\n**Preferred Prerequisites:**\n\n* [Mise](https://github.com/mise-tea/mise)\n\t* Used to manage GoLang dependencies\n\t* But you can install GoLang dependencies manually if you want\n\n```sh\n$ mise trust\n$ make install USR_BIN_DIR=\"$HOME/bin\"\n$ goprompt install zsh \u003e\u003e ~/.zshrc\n# or\n$ goprompt install fish \u003e\u003e ~/.config/fish/conf.d/50-goprompt.fish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonlogicaldev%2Fshell.async-goprompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonlogicaldev%2Fshell.async-goprompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonlogicaldev%2Fshell.async-goprompt/lists"}