projects
/
grml-etc-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Release new version 0.7.2
[grml-etc-core.git]
/
etc
/
zsh
/
zshrc
diff --git
a/etc/zsh/zshrc
b/etc/zsh/zshrc
index
4e7ef09
..
37d3943
100644
(file)
--- a/
etc/zsh/zshrc
+++ b/
etc/zsh/zshrc
@@
-242,7
+242,7
@@
function zrcautoload() {
local -i ffound
ffile=$1
local -i ffound
ffile=$1
- (( found = 0 ))
+ (( f
f
ound = 0 ))
for fdir in ${fpath} ; do
[[ -e ${fdir}/${ffile} ]] && (( ffound = 1 ))
done
for fdir in ${fpath} ; do
[[ -e ${fdir}/${ffile} ]] && (( ffound = 1 ))
done
@@
-1225,7
+1225,7
@@
if zrcautoload colors && colors 2>/dev/null ; then
MAGENTA="%{${fg[magenta]}%}"
YELLOW="%{${fg[yellow]}%}"
WHITE="%{${fg[white]}%}"
MAGENTA="%{${fg[magenta]}%}"
YELLOW="%{${fg[yellow]}%}"
WHITE="%{${fg[white]}%}"
- NO_COLO
U
R="%{${reset_color}%}"
+ NO_COLOR="%{${reset_color}%}"
else
BLUE=$'%{\e[1;34m%}'
RED=$'%{\e[1;31m%}'
else
BLUE=$'%{\e[1;34m%}'
RED=$'%{\e[1;31m%}'
@@
-1234,7
+1234,7
@@
else
WHITE=$'%{\e[1;37m%}'
MAGENTA=$'%{\e[1;35m%}'
YELLOW=$'%{\e[1;33m%}'
WHITE=$'%{\e[1;37m%}'
MAGENTA=$'%{\e[1;35m%}'
YELLOW=$'%{\e[1;33m%}'
- NO_COLO
U
R=$'%{\e[0m%}'
+ NO_COLOR=$'%{\e[0m%}'
fi
# gather version control information for inclusion in a prompt
fi
# gather version control information for inclusion in a prompt
@@
-1266,10
+1266,10
@@
if [[ "$TERM" == dumb ]] ; then
zstyle ':vcs_info:*' actionformats "(%s%)-[%b|%a] " "zsh: %r"
zstyle ':vcs_info:*' formats "(%s%)-[%b] " "zsh: %r"
else
zstyle ':vcs_info:*' actionformats "(%s%)-[%b|%a] " "zsh: %r"
zstyle ':vcs_info:*' formats "(%s%)-[%b] " "zsh: %r"
else
- # these are the same, just with a lot of colo
u
rs:
- zstyle ':vcs_info:*' actionformats "${MAGENTA}(${NO_COLO
UR}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${YELLOW}|${RED}%a${MAGENTA}]${NO_COLOU
R} " \
+ # these are the same, just with a lot of colors:
+ zstyle ':vcs_info:*' actionformats "${MAGENTA}(${NO_COLO
R}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${YELLOW}|${RED}%a${MAGENTA}]${NO_COLO
R} " \
"zsh: %r"
"zsh: %r"
- zstyle ':vcs_info:*' formats "${MAGENTA}(${NO_COLO
UR}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${MAGENTA}]${NO_COLOU
R}%} " \
+ zstyle ':vcs_info:*' formats "${MAGENTA}(${NO_COLO
R}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${MAGENTA}]${NO_COLO
R}%} " \
"zsh: %r"
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat "%b${RED}:${YELLOW}%r"
fi
"zsh: %r"
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat "%b${RED}:${YELLOW}%r"
fi
@@
-1396,13
+1396,13
@@
else
# prompt below)
if [[ $GRMLPROMPT -gt 0 ]] ; then
PROMPT="${RED}${EXITCODE}${CYAN}[%j running job(s)] ${GREEN}{history#%!} ${RED}%(3L.+.) ${BLUE}%* %D
# prompt below)
if [[ $GRMLPROMPT -gt 0 ]] ; then
PROMPT="${RED}${EXITCODE}${CYAN}[%j running job(s)] ${GREEN}{history#%!} ${RED}%(3L.+.) ${BLUE}%* %D
-${BLUE}%n${NO_COLO
U
R}@%m %40<...<%B%~%b%<< "
+${BLUE}%n${NO_COLOR}@%m %40<...<%B%~%b%<< "
else
# This assembles the primary prompt string
if (( EUID != 0 )); then
else
# This assembles the primary prompt string
if (( EUID != 0 )); then
- PROMPT="
${RED}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${BLUE}%n${NO_COLOUR}@%m
%40<...<%B%~%b%<< "
+ PROMPT="
%B${RED}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${BLUE}%b%n${NO_COLOR}@${CYAN}%m${NO_COLOR}
%40<...<%B%~%b%<< "
else
else
- PROMPT="
${BLUE}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${RED}%n${NO_COLOUR}@%m
%40<...<%B%~%b%<< "
+ PROMPT="
%B${BLUE}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${RED}%b%n${NO_COLOR}@${CYAN}%m${NO_COLOR}
%40<...<%B%~%b%<< "
fi
fi
fi
fi
fi
fi
@@
-2632,12
+2632,15
@@
xtrename() {
# API reference: https://code.google.com/apis/urlshortener/
function zurl() {
emulate -L zsh
# API reference: https://code.google.com/apis/urlshortener/
function zurl() {
emulate -L zsh
+ setopt extended_glob
+
if [[ -z $1 ]]; then
print "USAGE: zurl <URL>"
return 1
fi
if [[ -z $1 ]]; then
print "USAGE: zurl <URL>"
return 1
fi
- local PN url prog api json data
+ local PN url prog api json contenttype item
+ local -a data
PN=$0
url=$1
PN=$0
url=$1
@@
-2655,11
+2658,19
@@
function zurl() {
api='https://www.googleapis.com/urlshortener/v1/url'
contenttype="Content-Type: application/json"
json="{\"longUrl\": \"${url}\"}"
api='https://www.googleapis.com/urlshortener/v1/url'
contenttype="Content-Type: application/json"
json="{\"longUrl\": \"${url}\"}"
- data=$($prog --silent -H ${contenttype} -d ${json} $api)
- # Match against a regex and print it
- if [[ $data =~ '"id": "(http://goo.gl/[[:alnum:]]+)"' ]]; then
- print $match;
- fi
+ data=(${(f)"$($prog --silent -H ${contenttype} -d ${json} $api)"})
+ # Parse the response
+ for item in "${data[@]}"; do
+ case "$item" in
+ ' '#'"id":'*)
+ item=${item#*: \"}
+ item=${item%\",*}
+ printf '%s\n' "$item"
+ return 0
+ ;;
+ esac
+ done
+ return 1
}
#f2# Find history events by search pattern and list them by date.
}
#f2# Find history events by search pattern and list them by date.