gitstatus/README.md

78 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

# gitstatus
2021-05-19 13:32:27 +03:00
`gitstatus` is a plugin made for prompts - it tells you how many things have
2021-06-19 09:49:03 +03:00
changed since the last git commit in a repository.
2021-05-19 13:32:27 +03:00
2022-01-20 20:39:20 +02:00
Example with `PS1='%F{blue}%~%F{default} $(gitstatus -i)%F{green}$%F{default} '`:
2021-10-01 17:46:40 +03:00
![](./screenshot.png)
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
#### Manual
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
```
git clone "https://github.com/xylous/gitstatus.git" gitstatus
```
```zsh
2021-11-05 15:13:17 +02:00
source /path/to/installation/gitstatus.plugin.zsh
```
2021-11-05 15:13:17 +02:00
And of course, remember to replace `/path/to/installation` with the actual path
to the program.
#### With a plugin manager
You could also use a plugin manager, such as zpm:
```
zpm load xylous/gitstatus
2021-05-19 13:32:27 +03:00
```
## Usage
2021-11-05 15:13:17 +02:00
Change your prompt to include `$(gitstatus)` wherever you need. Note that you'll
need to `setopt PROMPT_SUBST` and that you're going to need to use single
quotes.
So, for example:
2021-05-19 13:32:27 +03:00
```zsh
2021-11-05 15:13:17 +02:00
setopt PROMPT_SUBST
PROMPT='%F{blue}%~%F{default} $(gitstatus -i)$ '
2021-05-19 13:32:27 +03:00
```
### Options
- `-i`: use if your prompt is inline. It appends a whitespace character if the
output is non-empty; the formatting will always be proper, even if outside a git
repository.
2021-05-19 13:32:27 +03:00
## Roadmap
2021-10-01 17:46:40 +03:00
- [x] add screenshots
- [x] have better support for inline prompts
2021-08-08 17:57:38 +03:00
- [ ] cover more `git status` flags
2021-05-19 13:32:27 +03:00
## Contributing
Pull requests and issues are welcome.