aboutsummaryrefslogtreecommitdiff
path: root/readme.md
blob: 65ec7ca66b524f6a6e20546ecb7ab55526d7d263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# pista

> a simple {bash, zsh} prompt for programmers 

![pista.png](https://files.nerdypepper.me/52.png)

### features

 - shortened current working directory
 - git info (branch/commit, ahead/behind status, repo status)
 - superuser indicator
 - fully configurable
 - m̶̛̩̬͎̲͚͙͇͂͌̏͒̎͗̆̚i̡̛̬̩͙̣̤͈̥̟͔͆̈͑̑͠͝ņ̵̛̟̥̹͍̻͍̐͛̑͋ì̴̛̗̫͍̯͈̖̝͍͊̏͗̍̈́̾m̨̼̦͈͍͕͊̀̾̽̿̅͋͆͜a̵͔̥̫̲͙͒̎͋͌̑͘̚͜͡l̵̨̧̛̪̭̣͚͇͌̇͋̌͘͢

### installation
```shell
$ cargo install pista
```

cargo is rust's package manager. if you dont have cargo installed, head over to
http://rustup.rs and follow the instructions.  
make sure to add `$HOME/.cargo/bin` to your `$PATH`!


 - bash users, set your `PS1`:  
```shell
PS1='$(pista)'    # regular variant
PS1='$(pista -m)' # minimal variant
```

 - zsh users, add this to your `.zshrc`:  
```shell
autoinit -Uz add-zsh-hook
_pista_prompt() {
	PROMPT="$(pista -z)"   # `pista -zm` for the miminal variant
}
add-zsh-hook precmd _pista_prompt
```


`pista` handles prompt modifications when you enter virtual environments.
make sure to disable `virtualenv`'s changes.
```shell
export VIRTUAL_ENV_DISABLE_PROMPT=1
```

thats it! read on if you aren't happy with the defaults.

### configuration

this is the default configuration. drop this in your `.bashrc` (or `.zshrc`) to get started.
remember to `source ~/.bashrc` (or `source ~/.zshrc`) to observe the changes!

```
# prompt string to display, for regular users
export PROMPT_CHAR="$"
export PROMPT_CHAR_COLOR="green"

# prompt string to display, for the root user
export PROMPT_CHAR_ROOT="#"
export PROMPT_CHAR_ROOT_COLOR="red"

# if SHORTEN_CWD is set to 1, `/home/nerdypepper/code` is shortened to
# `/h/n/code`
export SHORTEN_CWD=1
export CWD_COLOR="white"

# if EXPAND_TILDE is set to 0, `/home/nerdypepper` is shortened to `~`
export EXPAND_TILDE=0

# there are three possible states for a git repo
# - unstaged (working tree has been modified) 
# - staged (staging area has been modified)
# - clean (all staged changes have committed)

# symbol to represent clean repo state
export GIT_CLEAN="·"
export GIT_CLEAN_COLOR="green"

# symbol to represent unstaged repo state
export GIT_WT_MODIFIED="×"
export GIT_WT_MODIFIED_COLOR="red"

# symbol to represent staged repo state
export GIT_INDEX_MODIFIED="±"
export GIT_INDEX_MODIFIED_COLOR="yellow"

# if HEAD ref peels to branch
export BRANCH_COLOR="green"

# if HEAD ref peels to a commit (detached state)
export COMMIT_COLOR="green"
```

all 16 colors are available:
```
black
red
green
yellow
blue
magenta (or purple)
cyan
white

bright black
bright red
bright green
bright yellow
bright blue
bright magenta (or purple)
bright cyan
bright white
```