Skip to content

lmllrjr/backbone-zsh-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 

Repository files navigation

* screenshot taken in warp terminal

BB 🦴 -- backbone zsh prompt -- git

A bare minimum single file prompt, fast as a roadrunner MEEP! MEEP! 💨 ...



BackBone is a prompt with the bare minimum needed for a working zsh prompt that tracks git changes.
BB1 is a blazingly fast the roadrunner of the prompts! Be prepared for some Meep! Meep! Moments.

I was in need of a super simple minimal prompt that fulfills my needs. It has to be fast, easy to setup, a single file and have git support with minimal features. Furthermore i ended up building this one.

If you are like me and just looking for a prompt that is "not more than the bare minimum needed"
-- Stop looking!

Table of Contents

Information in advance

Projects Path

This prompt is optimized to be speedy in big repositories. By default it will only enable checking for git changes in specified folder.

The default setup expects the projects you work on daily to be in the folder $HOME/code. If you are not happy with that setup simply set the BB_PROMPT_PROJECTS_PATH="$HOME/whatever/you/desire var to your desired path.

Note

It is also possible to deacitvate that behaviour completely by setting the BB_PROMPT_PROJECTS=false to false.

flowchart TD
    A{"BB_PROMPT_PROJECTS"};
    A -- "true" --> B["only check for changes in `BB_PROMPT_PROJECTS_PATH`\n\n(default: `${HOME}/code`)"];
    A -- "false" --> C["check for changes everywhere"];
    B ----> D["vcs_info"];
    C ----> D["vcs_info"];

Install

Clone the repository:

  • Clone into ~/.zsh
    git clone git@github.com:lmllrjr/backbone-zsh-prompt.git ~/.zsh/backbone-zsh-prompt
  • Clone into ~/.config/zsh
    git clone git@github.com:lmllrjr/backbone-zsh-prompt.git ~/.config/zsh/backbone-zsh-prompt

For the purists, download the only relevant file bb.zsh:

  • Download to ~/.zsh:
    curl -fLo ~/.zsh/backbone-zsh-prompt/bb.zsh --create-dirs \
    https://raw.githubusercontent.com/lmllrjr/backbone-zsh-prompt/main/bb.zsh
  • Download to ~/.config/zsh:
    curl -fLo ~/.config/zsh/backbone-zsh-prompt/bb.zsh --create-dirs \
    https://raw.githubusercontent.com/lmllrjr/backbone-zsh-prompt/main/bb.zsh
  • Simply just download the file without creating any directories:
    curl -fLO https://raw.githubusercontent.com/lmllrjr/backbone-zsh-prompt/main/bb.zsh

Load the prompt in your .zshrc file:

  • Load from ~/.zsh:
    # only load prompt if the `bb.zsh` file exists
    [ -f $HOME/.zsh/backbone-zsh-prompt/bb.zsh ] && \
    source $HOME/.zsh/backbone-zsh-prompt/bb.zsh
  • Load from ~/.config/zsh:
    # only load prompt if the `bb.zsh` file exists
    [ -f $HOME/.config/zsh/backbone-zsh-prompt/bb.zsh ] && \
    source $HOME/.config/zsh/backbone-zsh-prompt/bb.zsh

Explanation of elements

Colorization options / settings

Option Description Default value Type
BB_PROMPT_DIR The working directory "#6c71c4" #6c71c4 string
BB_PROMPT_GIT The shown VCS in use (git:()) "#586e75" #586e75 string
BB_PROMPT_BRANCH The git branch name "#dc322f" #dc322f string
BB_PROMPT_ACTION The git actions rebase/merge "#b58900" #b58900 string
BB_PROMPT_AHEAD_BEHIND The ahead and behind arrows + counters "#2aa198" #2aa198 string
BB_PROMPT_TAG The git tag "#93a1a1" #93a1a1 string
BB_PROMPT_COUNT Changed file count on branch "#93a1a1" #93a1a1 string
BB_PROMPT_SHOW_TAG Turn show tag option on or off false bool
BB_PROMPT_PROJECTS_PATH The path of the project folder "${HOME}/code" string
BB_PROMPT_PROJECTS Turn the project folder option on or off true bool
BB_PROMPT_SIGN Set the character of the prompt "%" string

Example config

Just set the variables in your .zshrc file.

Important

Make sure to set the vars before actually loading the prompt!

~/.zshrc:

# set vars
export BB_PROMPT_DIR=6
export BB_PROMPT_GIT="#EEEEEE"
export BB_PROMPT_TAG="blue"
export BB_PROMPT_PROJECTS_PATH="${HOME}/my/projects/path"
export BB_PROMPT_PROJECTS=false
export BB_PROMPT_SHOW_TAG=true
export BB_PROMPT_SIGN="$"

# only load prompt if the `bb.zsh` file exists
[ -f $HOME/.config/zsh/backbone-zsh-prompt/bb.zsh ] && \
source $HOME/.config/zsh/backbone-zsh-prompt/bb.zsh

Note

If you want a fully-fledged prompt you should use one of the more sophisticated projects around github.
E.g. Pure ❤️.

Todo

  • better screenshots (do not forget ahead and behind)
    • now has a better and more appealing picture that explains the elements of the prompt
  • adjust color of slash in between ahead and behind
    • now has the color of BB_PROMPT_GIT
  • option to turn off estyle-cfc / only checking for changes in ~/code/...
    • furthermore there is another option to set the directory of the projects folder
  • remove more unused code!?
  • option for showing git tag!?
  • option to set prompt sign for e.g. iterm
  • use ansi escape codes for terminal colors when not in warp terminal
  • fix git-tag issue (when git-tag is set but no git tag is present the space between the branchname and staged/unstaged symbol is not being displayed)
  • easier installation
  • custom colorization of prompt sign success/failure
  • make it faster!?
  • option for DEBUG!?

- [ ] adjust VARs (more/rmv?)

Footnotes

  1. BackBone zsh prompt