diff options
-rw-r--r-- | readme.md | 95 |
1 files changed, 89 insertions, 6 deletions
@@ -1,12 +1,95 @@ | |||
1 | # pista | 1 | # pista |
2 | 2 | ||
3 | > my bash prompt, reWriTteN iN rUst | 3 | > a simple bash prompt for programmers |
4 | 4 | ||
5 | hopefully it will look like this when done: | 5 | ### installation |
6 | ```shell | 6 | ```shell |
7 | ~/c/r/pista master × | 7 | $ cargo install pista |
8 | $ ls | 8 | ``` |
9 | |||
10 | cargo is rust's package manager. if you dont have cargo installed, head over to | ||
11 | http://rustup.rs and follow the instructions. | ||
12 | make sure to add `$HOME/.cargo/bin` to your `$PATH`! | ||
13 | |||
14 | |||
15 | once you have installed `pista`, set your `PS1` to use it! | ||
16 | ```shell | ||
17 | PS1="$(pista)" # regular variant | ||
18 | PS1="$(pista -m)" # minimal variant | ||
19 | ``` | ||
20 | |||
21 | |||
22 | `pista` handles prompt modifications when you enter virtual environments. | ||
23 | make sure to disable `virtualenv`'s changes. | ||
24 | ```shell | ||
25 | export VIRTUAL_ENV_DISABLE_PROMPT=1 | ||
26 | ``` | ||
27 | |||
28 | thats it! read on if you aren't happy with the defaults. | ||
29 | |||
30 | ### configuration | ||
31 | |||
32 | this is the default configuration. drop this in your `.bashrc` to get started. | ||
33 | remember to `source ~/.bashrc` to observe the changes! | ||
34 | |||
35 | ``` | ||
36 | # prompt string to display, for regular users | ||
37 | export PROMPT_CHAR="$" | ||
38 | export PROMPT_CHAR_COLOR="green" | ||
39 | |||
40 | # prompt string to display, for the root user | ||
41 | export PROMPT_CHAR_ROOT="#" | ||
42 | export PROMPT_CHAR_ROOT_COLOR="red" | ||
43 | |||
44 | # if SHORTEN_CWD is set to 1, `/home/nerdypepper/code` is shortened to | ||
45 | # `/h/n/code` | ||
46 | export SHORTEN_CWD=1 | ||
47 | export CWD_COLOR="white" | ||
48 | |||
49 | # if EXPAND_TILDE is set to 0, `/home/nerdypepper` is shortened to `~` | ||
50 | export EXPAND_TILDE=0 | ||
51 | |||
52 | # there are three possible states for a git repo | ||
53 | # - unstaged (working tree has been modified) | ||
54 | # - staged (staging area has been modified) | ||
55 | # - clean (all staged changes have committed) | ||
56 | |||
57 | # symbol to represent clean repo state | ||
58 | export GIT_CLEAN="·" | ||
59 | export GIT_CLEAN_COLOR="green" | ||
60 | |||
61 | # symbol to represent unstaged repo state | ||
62 | export GIT_WT_MODIFIED="×" | ||
63 | export GIT_WT_MODIFIED_COLOR="red" | ||
64 | |||
65 | # symbol to represent staged repo state | ||
66 | export GIT_INDEX_MODIFIED="±" | ||
67 | export GIT_INDEX_MODIFIED_COLOR="yellow" | ||
68 | |||
69 | # if HEAD ref peels to branch | ||
70 | export BRANCH_COLOR="green" | ||
71 | |||
72 | # if HEAD ref peels to a commit (detached state) | ||
73 | export COMMIT_COLOR="green" | ||
74 | ``` | ||
75 | |||
76 | all 16 colors are available: | ||
77 | ``` | ||
78 | black | ||
79 | red | ||
80 | green | ||
81 | yellow | ||
82 | blue | ||
83 | magenta (or purple) | ||
84 | cyan | ||
85 | white | ||
9 | 86 | ||
10 | {cwd} {branch} {repo state} | 87 | bright black |
11 | {prompt_char} | 88 | bright red |
89 | bright green | ||
90 | bright yellow | ||
91 | bright blue | ||
92 | bright magenta (or purple) | ||
93 | bright cyan | ||
94 | bright white | ||
12 | ``` | 95 | ``` |