From f9d4a067ecb9d3fa65326e5e6a76649ccf65434c Mon Sep 17 00:00:00 2001 From: Cory Snider Date: Sun, 15 Apr 2018 08:45:58 -0400 Subject: Reduce number of git calls when displaying prompt (#3795) The avit theme's _git_time_since_commit function was running git twice. Reduce it with a single call to `git log`, checking the exit code for success. --- themes/avit.zsh-theme | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'themes') diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 4f0dcbcc6..c43fcc9fe 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -50,9 +50,7 @@ function _ruby_version() { # use a neutral color, otherwise colors will vary according to time. function _git_time_since_commit() { # Only proceed if there is actually a commit. - if git log -1 > /dev/null 2>&1; then - # Get the last commit. - last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) + if last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null); then now=$(date +%s) seconds_since_last_commit=$((now-last_commit)) -- cgit v1.2.3-70-g09d2 From 8e1cfc91541a2c9daef9e0790323ecaf369229c2 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 15 Apr 2018 15:16:28 +0200 Subject: Fix emotty theme when using zsh 5.2 (#5998) see http://www.zsh.org/mla/workers/2015/msg03259.html --- themes/emotty.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'themes') diff --git a/themes/emotty.zsh-theme b/themes/emotty.zsh-theme index 34d491ff0..13adad78d 100644 --- a/themes/emotty.zsh-theme +++ b/themes/emotty.zsh-theme @@ -68,6 +68,10 @@ prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}" setopt promptsubst +# Workaround for zsh 5.2 release (kudos to @timothybasanov) +autoload +X VCS_INFO_nvcsformats +functions[VCS_INFO_nvcsformats]=${functions[VCS_INFO_nvcsformats]/local -a msgs/} + autoload -U add-zsh-hook autoload -Uz vcs_info -- cgit v1.2.3-70-g09d2 From fa93ea0d75c5079407862c3bbb48d2131577cd5d Mon Sep 17 00:00:00 2001 From: cori schlegel <46317+cori@users.noreply.github.com> Date: Sun, 15 Apr 2018 08:48:31 -0500 Subject: [rkj-repos] Check for 'hg prompt' and exit if not found (#6655) * Check for extension, and exit if not found. Addresses #6036 * Fix styles in rkj-repos.theme --- themes/rkj-repos.zsh-theme | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'themes') diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index ba2a0dba6..0d5a166ba 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -1,6 +1,9 @@ -# user, host, full path, and time/date -# on two lines for easier vgrepping -# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 +# user, host, full path, and time/date on two lines for easier vgrepping + +if ! grep -q "prompt" ~/.hgrc; then + echo "This theme requires 'hg prompt' (https://bitbucket.org/sjl/hg-prompt/overview)" + return 1 +fi function hg_prompt_info { hg prompt --angle-brackets "\ @@ -33,4 +36,3 @@ function retcode() {} PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}] %{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' - -- cgit v1.2.3-70-g09d2 From 86a0b8656213951d132e0466c5ffb24150b0aaf1 Mon Sep 17 00:00:00 2001 From: 安正超 Date: Wed, 18 Apr 2018 03:34:03 +0800 Subject: [cloud theme] add a space (#3215) --- themes/cloud.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'themes') diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme index 4efbf9776..59a3472b6 100644 --- a/themes/cloud.zsh-theme +++ b/themes/cloud.zsh-theme @@ -6,5 +6,5 @@ PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[gr ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" -- cgit v1.2.3-70-g09d2 From d7948b39dc662c8072a307869135c8a7cae89cf9 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 19 Apr 2018 23:32:53 +0200 Subject: [rkj-repos] Make `hg prompt` check less strict (#6746) * [rkj-repos] Make `hg prompt` check less strict Move the `hg prompt` check inside the hg_prompt_info function so that it returns an empty string if hg-prompt isn't installed. Fixes #6743. * [rkj-repos] Check for hg in `hg prompt` function --- themes/rkj-repos.zsh-theme | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'themes') diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index 0d5a166ba..65a075456 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -1,16 +1,13 @@ # user, host, full path, and time/date on two lines for easier vgrepping -if ! grep -q "prompt" ~/.hgrc; then - echo "This theme requires 'hg prompt' (https://bitbucket.org/sjl/hg-prompt/overview)" - return 1 -fi - function hg_prompt_info { + if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then hg prompt --angle-brackets "\ %{$reset_color%}><:%{$fg[magenta]%}%{$reset_color%}>\ %{$reset_color%}>\ %{$fg[red]%}%{$reset_color%}< patches: >" 2>/dev/null + fi } ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" -- cgit v1.2.3-70-g09d2 From 604f580f0546aefd6aef00b1a1943d68f4cebae6 Mon Sep 17 00:00:00 2001 From: Sean Abraham Date: Sun, 22 Apr 2018 13:37:06 -0700 Subject: Make steeef theme much faster by not iterating through all history (#6359) * Make steef much faster by not printing all history each time * Use whence -c to expand shell functions as well * Use $2 (expanded command about to be ran) --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'themes') diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index b72a41c92..88ef1ca1b 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -62,7 +62,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats "" function steeef_preexec { - case "$(history $HISTCMD)" in + case "$2" in *git*) PR_GIT_UPDATE=1 ;; -- cgit v1.2.3-70-g09d2 From 45a9f284641a23baa142743d8a6136d4e300c465 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 23 Apr 2018 20:47:19 +0200 Subject: [half-life] Fix last command check Fixes #6758 --- themes/half-life.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'themes') diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index 5f987099d..8b458cde9 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -60,7 +60,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats "" function steeef_preexec { - case "$(history $HISTCMD)" in + case "$2" in *git*) PR_GIT_UPDATE=1 ;; -- cgit v1.2.3-70-g09d2