2021-05-19 13:32:27 +03:00
|
|
|
# gitstatus.zsh
|
|
|
|
|
2021-06-19 09:49:03 +03:00
|
|
|
`gitstatus.zsh` is a plugin made for prompts - it tells you how many things have
|
|
|
|
changed since the last git commit in a repository.
|
2021-05-19 13:32:27 +03:00
|
|
|
|
|
|
|
## Why such a thing?
|
|
|
|
|
|
|
|
Frankly, it's because I needed something small and fast that would integrate
|
|
|
|
well with my (multi-line) prompt.
|
|
|
|
|
2021-06-19 09:49:03 +03:00
|
|
|
Is it useful? For me and probably a handful other people, yes.
|
2021-05-19 13:32:27 +03:00
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
|
|
- zsh
|
|
|
|
- git
|
|
|
|
- awk
|
|
|
|
|
|
|
|
### Installation
|
|
|
|
|
2021-08-08 17:57:38 +03:00
|
|
|
Clone this repository locally, on your machine, for example:
|
2021-05-19 13:32:27 +03:00
|
|
|
|
|
|
|
```
|
2021-08-08 17:57:38 +03:00
|
|
|
git clone "https://github.com/xylous/gitstatus.zsh.git" gitstatus
|
2021-05-19 13:32:27 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Add the following lines to your zshrc:
|
|
|
|
|
|
|
|
```zsh
|
|
|
|
function precmd()
|
|
|
|
{
|
2021-06-19 09:49:03 +03:00
|
|
|
local gitstatus="$(path/to/installation/gitstatus.plugin.zsh)"
|
2021-08-08 17:57:38 +03:00
|
|
|
PS1="%F{blue}%~%F{default} ${gitstatus} $ "
|
2021-05-19 13:32:27 +03:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-06-19 09:49:03 +03:00
|
|
|
`precmd()` is a zsh builtin function that executes a series of commands right
|
|
|
|
before the prompt is drawn. In this example, it updates the output of the
|
|
|
|
`gitstatus` script and then uses it in a prompt.
|
2021-05-19 13:32:27 +03:00
|
|
|
|
2021-06-19 09:49:03 +03:00
|
|
|
And of course, remember to replace `path/to/installation` with the actual path
|
|
|
|
to the program.
|
2021-05-19 13:32:27 +03:00
|
|
|
|
|
|
|
## Roadmap
|
|
|
|
|
2021-08-08 17:57:38 +03:00
|
|
|
- [ ] add screenshots
|
|
|
|
- [ ] cover more `git status` flags
|
2021-05-19 13:32:27 +03:00
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
Pull requests and issues are welcome.
|