From 4f4ab08339c721ab82c18c4f9a487437016c797d Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Mon, 19 Aug 2013 19:02:28 -0700 Subject: [PATCH 1/7] Added auto completion for git-note --- plugins/git-note/git-note.plugin.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 plugins/git-note/git-note.plugin.zsh diff --git a/plugins/git-note/git-note.plugin.zsh b/plugins/git-note/git-note.plugin.zsh new file mode 100644 index 000000000..a48c23366 --- /dev/null +++ b/plugins/git-note/git-note.plugin.zsh @@ -0,0 +1,18 @@ +#compdef git +__git_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +_git-note() { + _arguments '-b :branch-name:__git_branch_names [branch to attach note to]' \ + '-l[list all branches with notes]' \ + '-v[also show branches without notes]' +} + +zstyle ':completion:*:*:git:*' user-commands \ + note:'add a note to branch' \ + From 5b78ec2d73c1459c4047155f5e2ea32a04473c12 Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Mon, 19 Aug 2013 19:08:37 -0700 Subject: [PATCH 2/7] fix --- plugins/git-note/git-note.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/git-note/git-note.plugin.zsh b/plugins/git-note/git-note.plugin.zsh index a48c23366..599b32e4f 100644 --- a/plugins/git-note/git-note.plugin.zsh +++ b/plugins/git-note/git-note.plugin.zsh @@ -8,8 +8,12 @@ __git_branch_names() { } _git-note() { - _arguments '-b :branch-name:__git_branch_names [branch to attach note to]' \ + _arguments \ + - set1 \ + '-b[branch to attach note to]:branch-name:__git_branch_names ' \ + - set2 \ '-l[list all branches with notes]' \ + - set3 \ '-v[also show branches without notes]' } From d7f4aed4a7dd69048fc3de490074fd0b40fcc323 Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Tue, 20 Aug 2013 13:26:44 -0700 Subject: [PATCH 3/7] rearrange vcs info --- themes/rkj-repos.zsh-theme | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index 4ab3bc757..38e075e9f 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -2,7 +2,7 @@ # 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 -function hg_prompt_info { +function rkj_hg_prompt_info { hg prompt --angle-brackets "\ %{$reset_color%}>\ %{$reset_color%}>\ @@ -17,15 +17,19 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" -function mygit() { +function rkj_git_prompt_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo -n "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" } function retcode() {} +function rkj_vcs_info() { + rkj_git_prompt_info + rkj_hg_prompt_info +} # alternate prompt with git & hg PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] <$(rkj_vcs_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 472bd078823750688df57934950cf3653d9f3afc Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Tue, 27 Aug 2013 13:49:05 -0700 Subject: [PATCH 4/7] random prompt sign for every session --- themes/rkj-repos.zsh-theme | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index 38e075e9f..7e57903bb 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -28,8 +28,11 @@ function rkj_vcs_info() { rkj_git_prompt_info rkj_hg_prompt_info } +signs=(@ ☢ ☸ ☹ ☺ ☻ ☼ ☀ ☄ ☠ ☣ ☯ ♈ ♻ ♼ ♽ ⚙) +PROMPT_SIGN=$signs[$[${RANDOM} % ${#signs}]] + # alternate prompt with git & hg PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] <$(rkj_vcs_info)>%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] $(rkj_vcs_info)$PROMPT_SIGN%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 51d135fbda3249eb38f1b6c709dbc9d3c08b800b Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Thu, 29 Aug 2013 13:12:13 -0700 Subject: [PATCH 5/7] merge two themes and add some comments --- themes/rkj-repos.zsh-theme | 38 ------------------------------ themes/rkj.zsh-theme | 47 ++++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 43 deletions(-) delete mode 100644 themes/rkj-repos.zsh-theme diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme deleted file mode 100644 index 7e57903bb..000000000 --- a/themes/rkj-repos.zsh-theme +++ /dev/null @@ -1,38 +0,0 @@ -# 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 - -function rkj_hg_prompt_info { - hg prompt --angle-brackets "\ -%{$reset_color%}>\ -%{$reset_color%}>\ -%{$fg[red]%}%{$reset_color%}< -patches: >" 2>/dev/null -} - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" -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[magenta]%}✂" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" - -function rkj_git_prompt_info() { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - echo -n "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" -} - -function retcode() {} - -function rkj_vcs_info() { - rkj_git_prompt_info - rkj_hg_prompt_info -} -signs=(@ ☢ ☸ ☹ ☺ ☻ ☼ ☀ ☄ ☠ ☣ ☯ ♈ ♻ ♼ ♽ ⚙) -PROMPT_SIGN=$signs[$[${RANDOM} % ${#signs}]] - -# alternate prompt with git & hg -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] $(rkj_vcs_info)$PROMPT_SIGN%{\e[0m%}%b ' -PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' - diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme index fe06161c8..2b6566197 100644 --- a/themes/rkj.zsh-theme +++ b/themes/rkj.zsh-theme @@ -1,9 +1,46 @@ -# 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 +# Fork and mash of many other prompts. +# +# Has user, host, full path, and time/date along with vcs info. +# on two lines for easier visual grepping +# entry in a nice long thread on the Arch Linux forums: +# http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 +# +# If you do not wish to have vcs info redefine function rkj_vcs_info to be empty. -function retcode() {} +function rkj_hg_prompt_info { + hg prompt --angle-brackets "\ +%{$reset_color%}>\ +%{$reset_color%}>\ +%{$fg[red]%}%{$reset_color%}< +patches: >" 2>/dev/null +} + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" +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[magenta]%}✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" + +function rkj_git_prompt_info() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo -n "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +function rkj_vcs_info() { + rkj_git_prompt_info + rkj_hg_prompt_info +} + +# random prompt sign +signs=(@ ☢ ☸ ☹ ☺ ☻ ☼ ☀ ☄ ☠ ☣ ☯ ♈ ♻ ♼ ♽ ⚙) +PROMPT_SIGN=$signs[$[${RANDOM} % ${#signs}]] + +function retcode() { + return $? +} PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B]%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] $(rkj_vcs_info)$PROMPT_SIGN%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 9ef36794792be435206d134ae6c2c530f3c141e7 Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Thu, 29 Aug 2013 13:21:20 -0700 Subject: [PATCH 6/7] comment --- plugins/git-note/git-note.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git-note/git-note.plugin.zsh b/plugins/git-note/git-note.plugin.zsh index 599b32e4f..0c9ac897b 100644 --- a/plugins/git-note/git-note.plugin.zsh +++ b/plugins/git-note/git-note.plugin.zsh @@ -1,4 +1,6 @@ #compdef git +# Completion for git-note sciprt: +# https://bitbucket.org/rkj/dotfiles/src/88f2d39f09ae40622c9561c366cd97d3363fe57c/bin/git-note?at=default __git_branch_names() { local expl declare -a branch_names From f302112f4c6c353ce536dece6275cdcfcbf56a32 Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Wed, 16 Oct 2013 15:50:56 -0700 Subject: [PATCH 7/7] Change prompt to function; get rid of function keyword --- themes/rkj.zsh-theme | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme index 2b6566197..a3f79026c 100644 --- a/themes/rkj.zsh-theme +++ b/themes/rkj.zsh-theme @@ -7,7 +7,7 @@ # # If you do not wish to have vcs info redefine function rkj_vcs_info to be empty. -function rkj_hg_prompt_info { +rkj_hg_prompt_info() { hg prompt --angle-brackets "\ %{$reset_color%}>\ %{$reset_color%}>\ @@ -22,25 +22,27 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" -function rkj_git_prompt_info() { +rkj_git_prompt_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo -n "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" } -function rkj_vcs_info() { +rkj_vcs_info() { rkj_git_prompt_info rkj_hg_prompt_info } # random prompt sign signs=(@ ☢ ☸ ☹ ☺ ☻ ☼ ☀ ☄ ☠ ☣ ☯ ♈ ♻ ♼ ♽ ⚙) -PROMPT_SIGN=$signs[$[${RANDOM} % ${#signs}]] +rkj_prompt() { + echo $signs[$[${RANDOM} % ${#signs}]] +} -function retcode() { +rkj_retcode() { return $? } PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] $(rkj_vcs_info)$PROMPT_SIGN%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(rkj_retcode)%{\e[0;34m%}%B] $(rkj_vcs_info)$(rkj_prompt)%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '