From c2449b7aa528e9b5a03d690a5a73b46d960e5841 Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Wed, 29 May 2019 18:03:00 +0530 Subject: support zsh --- readme.md | 17 +++++++++++++---- src/vcs.rs | 2 +- 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 @@ # pista -> a simple bash prompt for programmers +> a simple {bash, zsh} prompt for programmers ![pista.png](https://files.nerdypepper.me/52.png) @@ -22,12 +22,21 @@ http://rustup.rs and follow the instructions. make sure to add `$HOME/.cargo/bin` to your `$PATH`! -once you have installed `pista`, set your `PS1` to use it! + - 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") # `pista -m` 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. @@ -39,8 +48,8 @@ thats it! read on if you aren't happy with the defaults. ### configuration -this is the default configuration. drop this in your `.bashrc` to get started. -remember to `source ~/.bashrc` to observe the changes! +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 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)> repo_stat = stat_char.color(&git_index_modified_color[..]); }, // STATE: committed (changes have been saved in the repo) - _ => { } + _ => {} } } return Some((branch, repo_stat)) -- cgit v1.2.3