diff options
author | NerdyPepper <[email protected]> | 2019-05-29 13:33:00 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2019-05-29 13:33:00 +0100 |
commit | c2449b7aa528e9b5a03d690a5a73b46d960e5841 (patch) | |
tree | 755fe4dbad2eff86ca01f6f6aca19157a64fa044 | |
parent | b06c61015559175144c517cf7fdfbb6697179552 (diff) |
support zsh
-rw-r--r-- | readme.md | 17 | ||||
-rw-r--r-- | src/vcs.rs | 2 |
2 files changed, 14 insertions, 5 deletions
@@ -1,6 +1,6 @@ | |||
1 | # pista | 1 | # pista |
2 | 2 | ||
3 | > a simple bash prompt for programmers | 3 | > a simple {bash, zsh} prompt for programmers |
4 | 4 | ||
5 | ![pista.png](https://files.nerdypepper.me/52.png) | 5 | ![pista.png](https://files.nerdypepper.me/52.png) |
6 | 6 | ||
@@ -22,12 +22,21 @@ http://rustup.rs and follow the instructions. | |||
22 | make sure to add `$HOME/.cargo/bin` to your `$PATH`! | 22 | make sure to add `$HOME/.cargo/bin` to your `$PATH`! |
23 | 23 | ||
24 | 24 | ||
25 | once you have installed `pista`, set your `PS1` to use it! | 25 | - bash users, set your `PS1`: |
26 | ```shell | 26 | ```shell |
27 | PS1="$(pista)" # regular variant | 27 | PS1="$(pista)" # regular variant |
28 | PS1="$(pista -m)" # minimal variant | 28 | PS1="$(pista -m)" # minimal variant |
29 | ``` | 29 | ``` |
30 | 30 | ||
31 | - zsh users, add this to your `.zshrc`: | ||
32 | ```shell | ||
33 | autoinit -Uz add-zsh-hook | ||
34 | _pista_prompt() { | ||
35 | PROMPT=$("pista") # `pista -m` for the miminal variant | ||
36 | } | ||
37 | add-zsh-hook precmd _pista_prompt | ||
38 | ``` | ||
39 | |||
31 | 40 | ||
32 | `pista` handles prompt modifications when you enter virtual environments. | 41 | `pista` handles prompt modifications when you enter virtual environments. |
33 | make sure to disable `virtualenv`'s changes. | 42 | make sure to disable `virtualenv`'s changes. |
@@ -39,8 +48,8 @@ thats it! read on if you aren't happy with the defaults. | |||
39 | 48 | ||
40 | ### configuration | 49 | ### configuration |
41 | 50 | ||
42 | this is the default configuration. drop this in your `.bashrc` to get started. | 51 | this is the default configuration. drop this in your `.bashrc` (or `.zshrc`) to get started. |
43 | remember to `source ~/.bashrc` to observe the changes! | 52 | remember to `source ~/.bashrc` (or `source ~/.zshrc`) to observe the changes! |
44 | 53 | ||
45 | ``` | 54 | ``` |
46 | # prompt string to display, for regular users | 55 | # prompt string to display, for regular users |
@@ -74,7 +74,7 @@ pub fn vcs_status() -> Option<(colored::ColoredString, colored::ColoredString)> | |||
74 | repo_stat = stat_char.color(&git_index_modified_color[..]); | 74 | repo_stat = stat_char.color(&git_index_modified_color[..]); |
75 | }, | 75 | }, |
76 | // STATE: committed (changes have been saved in the repo) | 76 | // STATE: committed (changes have been saved in the repo) |
77 | _ => { } | 77 | _ => {} |
78 | } | 78 | } |
79 | } | 79 | } |
80 | return Some((branch, repo_stat)) | 80 | return Some((branch, repo_stat)) |