From a67dfae72b5d52b7e94304083a51d57c5c718e97 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Wed, 8 Jan 2014 10:45:05 +0100 Subject: [PATCH 1/8] Set colour for user@hostname to red if we're root (or sudo) in the bira theme. --- themes/bira.zsh-theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 21572047..1ead9355 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,7 +1,13 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' + +if [[ $UID -eq 0 ]]; then + local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' +else + local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' +fi + local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' local rvm_ruby='' if which rvm-prompt &> /dev/null; then From 854c41d843385282dadc90b653429964f011d061 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:02 +0200 Subject: [PATCH 2/8] Fix in avit theme: $CARETCOLOR was not to actually colour the caret, so change to root user wouldn't show in the prompt. --- themes/avit.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 65466b82..f9a92827 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -2,7 +2,7 @@ PROMPT=' $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) -▶ ' +%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' From ceca00a50354c3c3aaceae6ce40caacf24d0bb54 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:50 +0200 Subject: [PATCH 3/8] Adapt some colours in the avit theme for better visibility in the default Ubuntu terminal theme. --- themes/avit.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index f9a92827..21478a35 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -8,8 +8,8 @@ PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -local _current_dir="%{$fg[blue]%}%3~%{$reset_color%} " -local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}" +local _current_dir="%{$terminfo[bold]$fg[blue]%}%3~%{$reset_color%} " +local _return_status="%{$terminfo[bold]$fg[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" function _user_host() { @@ -85,13 +85,13 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}◒ " +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ " # Colors vary depending on time lapsed. ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="exfxcxdxbxegedabagacad" From 18801e25d26c6a10c39e9ef9eeecd8921e9de4c7 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 17:53:36 +0200 Subject: [PATCH 4/8] Shorter way of creating bold colours in a ZSH theme (applied to the avit theme). --- themes/avit.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 21478a35..fc6b0045 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -8,8 +8,8 @@ PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -local _current_dir="%{$terminfo[bold]$fg[blue]%}%3~%{$reset_color%} " -local _return_status="%{$terminfo[bold]$fg[red]%}%(?..⍉)%{$reset_color%}" +local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " +local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" function _user_host() { From 63e216ba9d20cb5960aaa59e4bc38405dd03c52c Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 23:00:35 +0200 Subject: [PATCH 5/8] oh-my-zsh avit theme: instead of only showing the last 3 directories in the $PWD shorten the path by removing some middle parts if $PWD becomes too long. --- themes/avit.zsh-theme | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index fc6b0045..b5a05799 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,17 +1,25 @@ # AVIT ZSH Theme PROMPT=' -$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) +$(_user_host)$(_current_dir) $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" +function _current_dir() { + local _max_pwd_length="65" + if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then + echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} " + else + echo "%{$fg_bold[blue]%}%~%{$reset_color%} " + fi +} + function _user_host() { if [[ -n $SSH_CONNECTION ]]; then me="%n@%m" From 0a47451a462284d20c633a7d6b3431a71bf65759 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Tue, 8 Sep 2015 10:53:03 +0200 Subject: [PATCH 6/8] =?UTF-8?q?Updated=20colour=20of=20=E2=97=80=20in=20PR?= =?UTF-8?q?OMPT2=20of=20the=20avit=20theme.=20In=20commit=20729fd53=20I=20?= =?UTF-8?q?incorrectly=20only=20changed=20PROMPT1.=20Now=20both=20?= =?UTF-8?q?=E2=96=B6=20and=20=E2=97=80=20follow=20$CARETCOLOR.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/avit.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index b5a05799..3d097a24 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -4,7 +4,7 @@ PROMPT=' $(_user_host)$(_current_dir) $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' -PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' +PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' From 9c362484396560119e8ff7a5de0696a9765cb2c7 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:50 +0200 Subject: [PATCH 7/8] Better visible colours in avit for Ubuntu terminal Make some colours in the avit theme bold for better visibility in the default Ubuntu terminal theme. --- themes/avit.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 3d097a24..54cb357d 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -8,6 +8,7 @@ PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' +local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" From 55fed4f8cdfcf7791fd22b28ef65b00dcc9e1a5f Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:02 +0200 Subject: [PATCH 8/8] Fix use of CARETCOLOR in avit theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $CARETCOLOR was not to actually colour the caret, so change to root user wouldn't show in the prompt. Now both ▶ and ◀ follow $CARETCOLOR. --- themes/avit.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 54cb357d..87d5be30 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,7 +1,7 @@ # AVIT ZSH Theme PROMPT=' -$(_user_host)$(_current_dir) $(git_prompt_info) $(_ruby_version) +$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} '