aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2019-05-29 13:33:00 +0100
committerNerdyPepper <[email protected]>2019-05-29 13:33:00 +0100
commitc2449b7aa528e9b5a03d690a5a73b46d960e5841 (patch)
tree755fe4dbad2eff86ca01f6f6aca19157a64fa044
parentb06c61015559175144c517cf7fdfbb6697179552 (diff)
support zsh
-rw-r--r--readme.md17
-rw-r--r--src/vcs.rs2
2 files changed, 14 insertions, 5 deletions
diff --git a/readme.md b/readme.md
index 3425eee..23fa19f 100644
--- a/readme.md
+++ b/readme.md
@@ -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.
22make sure to add `$HOME/.cargo/bin` to your `$PATH`! 22make sure to add `$HOME/.cargo/bin` to your `$PATH`!
23 23
24 24
25once you have installed `pista`, set your `PS1` to use it! 25 - bash users, set your `PS1`:
26```shell 26```shell
27PS1="$(pista)" # regular variant 27PS1="$(pista)" # regular variant
28PS1="$(pista -m)" # minimal variant 28PS1="$(pista -m)" # minimal variant
29``` 29```
30 30
31 - zsh users, add this to your `.zshrc`:
32```shell
33autoinit -Uz add-zsh-hook
34_pista_prompt() {
35 PROMPT=$("pista") # `pista -m` for the miminal variant
36}
37add-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.
33make sure to disable `virtualenv`'s changes. 42make 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
42this is the default configuration. drop this in your `.bashrc` to get started. 51this is the default configuration. drop this in your `.bashrc` (or `.zshrc`) to get started.
43remember to `source ~/.bashrc` to observe the changes! 52remember 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
diff --git a/src/vcs.rs b/src/vcs.rs
index aee4144..9673bc9 100644
--- a/src/vcs.rs
+++ b/src/vcs.rs
@@ -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))