From 497144fa957171c26e911cfe9976918145add61c Mon Sep 17 00:00:00 2001 From: Pascal Richier Date: Tue, 19 Aug 2014 17:52:57 +0200 Subject: [PATCH] Add option to print user@host see prompt -h sorin --- modules/prompt/functions/prompt_sorin_setup | 31 ++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index c3302ad1..8be9d507 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -3,6 +3,7 @@ # # Authors: # Sorin Ionescu +# Pascal Richier # # Screenshots: # http://i.imgur.com/nBEEZ.png @@ -71,11 +72,39 @@ function prompt_sorin_setup { 'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \ 'rprompt' '%A%B%S%a%d%m%r%U%u' + # Set User & Host + local userhost=${1:-''} + if [[ $userhost = "userhost" ]]; then + userhost='%B%F{green}[%F{yellow}%n%f@%F{red}%m%F{green}]%b' + else + userhost='' + fi + # Define prompts. - PROMPT='%F{cyan}${_prompt_sorin_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' + PROMPT=$userhost'%F{cyan}${_prompt_sorin_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_info[rprompt]}' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' } +function prompt_sorin_help { + cat <