GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
zsh-rust-git-prompt
Browse code
Added install step to avoid code signing errors
master
1 parent
ca4c576
commit
81501adbbd9023c3bb185e02469a5302a78e53cf
Nigel Stanger
authored
on 19 Oct 2022
Patch
Showing
1 changed file
README.md
Ignore Space
Show notes
View
README.md
# zsh-rust-git-prompt A bare-bones Git prompt for zsh implemented in Rust for speed (and as a learning exercise). Configuration is rudimentary because I figured “how often am I going to change the appearance of my Git prompt?” ## Features * Automatically detects Git repositories and only displays the prompt when inside one. * Includes the following Git status information: * current branch * commits ahead/behind remote * number of stashes (if any) * number of staged files (if any) * number of changed files (if any) * number of conflicting files (if any) * number of untracked files (if any) * number of ignored files (if any) * Basic format configuration via constants in the code. * Partial ANSI formatting support (currently only the ones I use). ## Dependencies * Rust (compilation). * Your favourite Nerd Font. ## Installation * Install Rust. * Install the relevant Nerd Font and set it as default in your terminal app. * Clone this repo. * `cargo build --release` * `rm <bindir>/zsh-rust-git-prompt` — **MANDATORY** on Apple Silicon, optional on Intel. Simply copying or moving the new binary over the top of the old one will cause a code signature mismatch and lead to obscure `zsh: killed` errors — see [Updating Mac Software](https://developer.apple.com/documentation/security/updating_mac_software). Removing the old binary first flushes its code signature cache. * `cp target/release/zsh-rust-git-prompt <bindir>` where `<bindir>` is in `PATH`. * Add this to your `.zshrc`: ```zsh RPROMPT='$(git status --porcelain=v2 --branch --show-stash -z 2>/dev/null | zsh-rust-git-prompt)'` ``` (Or `PROMPT` if you prefer, but it’s really designed more for `RPROMPT`.) ## Configuration * Changing the configuration requires a rebuild (`cargo build --release`) and reinstall. * The strings used to generate the various components of the status line can be modified by changing the constants at the top of `main.rs`. * The format of the status line can be modified by changing the format strings at the bottom of `main.rs`. * There is only partial support for ANSI formatting codes at present, provided by the `*_style()` functions.
# zsh-rust-git-prompt A bare-bones Git prompt for zsh implemented in Rust for speed (and as a learning exercise). Configuration is rudimentary because I figured “how often am I going to change the appearance of my Git prompt?” ## Features * Automatically detects Git repositories and only displays the prompt when inside one. * Includes the following Git status information: * current branch * commits ahead/behind remote * number of stashes (if any) * number of staged files (if any) * number of changed files (if any) * number of conflicting files (if any) * number of untracked files (if any) * number of ignored files (if any) * Basic format configuration via constants in the code. * Partial ANSI formatting support (currently only the ones I use). ## Dependencies * Rust (compilation). * Your favourite Nerd Font. ## Installation * Install Rust. * Install the relevant Nerd Font and set it as default in your terminal app. * Clone this repo. * `cargo build --release` * `mv target/release/zsh-rust-git-prompt <bindir>` where `<bindir>` is in `PATH`. * Add this to your `.zshrc`: ```zsh RPROMPT='$(git status --porcelain=v2 --branch --show-stash -z 2>/dev/null | zsh-rust-git-prompt)'` ``` (Or `PROMPT` if you prefer, but it’s really designed more for `RPROMPT`.) ## Configuration * Changing the configuration requires a rebuild (`cargo build --release`) and reinstall. * The strings used to generate the various components of the status line can be modified by changing the constants at the top of `main.rs`. * The format of the status line can be modified by changing the format strings at the bottom of `main.rs`. * There is only partial support for ANSI formatting codes at present, provided by the `*_style()` functions.
Show line notes below