Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/awgn/git-prompt
A fast git prompt for bash, zsh, fish...
https://github.com/awgn/git-prompt
Last synced: about 2 months ago
JSON representation
A fast git prompt for bash, zsh, fish...
- Host: GitHub
- URL: https://github.com/awgn/git-prompt
- Owner: awgn
- License: bsd-3-clause
- Created: 2012-02-04T13:07:27.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-03-30T11:31:26.000Z (2 months ago)
- Last Synced: 2024-03-30T12:29:17.180Z (2 months ago)
- Language: Haskell
- Homepage:
- Size: 110 KB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-zsh-plugins - git-prompt (awgn) - A fast `git` prompt for `bash`, `zsh` and `fish`. (Themes / ZSH on Windows)
- fucking-awesome-zsh-plugins - git-prompt (awgn) - A fast `git` prompt for `bash`, `zsh` and `fish`. (Themes / ZSH on Windows)
- awesome-zsh-plugins - git-prompt (awgn) - A fast `git` prompt for `bash`, `zsh` and `fish`. (Themes / ZSH on Windows)
README
Git-prompt
==========GitPrompt is an utility that, from a local git repository, renders information
into a string suitable to be embedded in the shell prompt. It is written in Haskell.Build
-----
To build the package run the following commands:```
cabal install --only-dep
runhaskell Setup configure --user
runhaskell Setup build
runhaskell Setup install
```or
```
stack build
stack install
```This will build and install the binary `GitPrompt` in either ~/.cabal/bin/ or
~/.local/bin/ directory.Building GitPrompt Statically
-----------------------------To statically build GitPrompt, you can use the following command:
```
stack build --flag GitPrompt:StaticBuild
stack install
```This command will instruct Stack to build GitPrompt with the StaticBuild flag, which will create a static binary.
The binary will include all necessary dependencies, making it more self-contained and easier to distribute.Usage
-----```
GitPrompt!Usage: GitPrompt [-p|--path PATH] [-t|--theme COLOR] [-s|--short] [-V|--version]
Available options:
-h,--help Show this help text
-p,--path PATH Specify the git-rository path ($PWD by default)
-t,--theme COLOR Specify the color theme
-s,--short Use short mode
-V,--version Print version
```Bash
----To use it with bash, configure the shell prompt as follow:
`PS1='\u@\h :: \[\033[1;32m\]\w\[\033[0m\] $(~/.local/bin/GitPrompt --theme blue)\n-> '`
Zsh
---For zsh, try the following configuration in .zshrc:
```
autoload -U colors && colors
setopt promptsubst
local git_prompt='$(/root/.local/bin/GitPrompt --theme blue)'
PS1="%{$fg[green]%}%n@%m %{$fg[blue]%}%c ${git_prompt} %# "
```Fish
----For fish shell, define the following function in
~/.config/fish/function/fish\_prompt.fish:```
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set -l git_prompt (~/.local/bin/GitPrompt --theme blue)if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end# PWD
set_color $fish_color_cwd
echo -n (prompt_pwd)
set_color normalprintf '%s '{"$git_prompt"}
if not test $last_status -eq 0
set_color $fish_color_error
endecho -n '$ '
end
```