watch=(notme root)
# automatically remove duplicates from these arrays
-typeset -U path cdpath fpath manpath
+typeset -U path PATH cdpath CDPATH fpath FPATH manpath MANPATH
# Load a few modules
is4 && \
}
chpwd() {
+ (( ZSH_SUBSHELL )) && return
(( $DIRSTACKSIZE <= 0 )) && return
[[ -z $DIRSTACKFILE ]] && return
grml_dirstack_filter $PWD && return
batteries=( /sys/class/power_supply/BAT*(N) )
if (( $#batteries > 0 )) ; then
for bat in $batteries ; do
- capacity=$(< $bat/capacity)
+ if [[ -e $bat/capacity ]]; then
+ capacity=$(< $bat/capacity)
+ else
+ typeset -F energy_full=$(< $bat/energy_full)
+ typeset -F energy_now=$(< $bat/energy_now)
+ typeset -i capacity=$(( 100 * $energy_now / $energy_full))
+ fi
case $(< $bat/status) in
Charging)
GRML_BATTERY_LEVEL+=" ^"
grml_prompt_fallback() {
setopt prompt_subst
- precmd() {
- (( ${+functions[vcs_info]} )) && vcs_info
- }
+ local p0 p1
p0="${RED}%(?..%? )${WHITE}${debian_chroot:+($debian_chroot)}"
p1="${BLUE}%n${NO_COLOR}@%m %40<...<%B%~%b%<< "'${vcs_info_msg_0_}'"%# "
else
PROMPT="${RED}${p0}${BLUE}${p1}"
fi
- unset p0 p1
}
if zrcautoload promptinit && promptinit 2>/dev/null ; then
else
print 'Notice: no promptinit available :('
grml_prompt_fallback
+ precmd() { (( ${+functions[vcs_info]} )) && vcs_info; }
fi
if is437; then
fi
else
grml_prompt_fallback
+ precmd() { (( ${+functions[vcs_info]} )) && vcs_info; }
fi
# Terminal-title wizardry
alias l='command ls -l'
fi
-alias mdstat='cat /proc/mdstat'
+if [[ -r /proc/mdstat ]]; then
+ alias mdstat='cat /proc/mdstat'
+fi
+
alias ...='cd ../../'
# generate alias named "$KERNELVERSION-reboot" so you can use boot with kexec:
# debian stuff
if [[ -r /etc/debian_version ]] ; then
- #a3# Execute \kbd{apt-cache search}
- alias acs='apt-cache search'
- #a3# Execute \kbd{apt-cache show}
- alias acsh='apt-cache show'
- #a3# Execute \kbd{apt-cache policy}
- alias acp='apt-cache policy'
- #a3# Execute \kbd{apt-get dist-upgrade}
- salias adg="apt-get dist-upgrade"
- #a3# Execute \kbd{apt-get install}
- salias agi="apt-get install"
- #a3# Execute \kbd{aptitude install}
- salias ati="aptitude install"
- #a3# Execute \kbd{apt-get upgrade}
- salias ag="apt-get upgrade"
- #a3# Execute \kbd{apt-get update}
- salias au="apt-get update"
- #a3# Execute \kbd{aptitude update ; aptitude safe-upgrade}
- salias -a up="aptitude update ; aptitude safe-upgrade"
- #a3# Execute \kbd{dpkg-buildpackage}
- alias dbp='dpkg-buildpackage'
- #a3# Execute \kbd{grep-excuses}
- alias ge='grep-excuses'
+ if [[ -z "$GRML_NO_APT_ALIASES" ]]; then
+ #a3# Execute \kbd{apt-cache search}
+ alias acs='apt-cache search'
+ #a3# Execute \kbd{apt-cache show}
+ alias acsh='apt-cache show'
+ #a3# Execute \kbd{apt-cache policy}
+ alias acp='apt-cache policy'
+ #a3# Execute \kbd{apt-get dist-upgrade}
+ salias adg="apt-get dist-upgrade"
+ #a3# Execute \kbd{apt-get install}
+ salias agi="apt-get install"
+ #a3# Execute \kbd{aptitude install}
+ salias ati="aptitude install"
+ #a3# Execute \kbd{apt-get upgrade}
+ salias ag="apt-get upgrade"
+ #a3# Execute \kbd{apt-get update}
+ salias au="apt-get update"
+ #a3# Execute \kbd{aptitude update ; aptitude safe-upgrade}
+ salias -a up="aptitude update ; aptitude safe-upgrade"
+ #a3# Execute \kbd{dpkg-buildpackage}
+ alias dbp='dpkg-buildpackage'
+ #a3# Execute \kbd{grep-excuses}
+ alias ge='grep-excuses'
+ fi
# get a root shell as normal user in live-cd mode:
if isgrmlcd && [[ $UID -ne 0 ]] ; then
alias su="sudo su"
fi
- #a1# Take a look at the syslog: \kbd{\$PAGER /var/log/syslog}
- salias llog="$PAGER /var/log/syslog" # take a look at the syslog
- #a1# Take a look at the syslog: \kbd{tail -f /var/log/syslog}
- salias tlog="tail -f /var/log/syslog" # follow the syslog
+fi
+
+# use /var/log/syslog iff present, fallback to journalctl otherwise
+if [ -e /var/log/syslog ] ; then
+ #a1# Take a look at the syslog: \kbd{\$PAGER /var/log/syslog || journalctl}
+ salias llog="$PAGER /var/log/syslog" # take a look at the syslog
+ #a1# Take a look at the syslog: \kbd{tail -f /var/log/syslog || journalctl}
+ salias tlog="tail -f /var/log/syslog" # follow the syslog
+elif check_com -c journalctl ; then
+ salias llog="journalctl"
+ salias tlog="journalctl -f"
fi
# sort installed Debian-packages by size
}
# make sure our environment is clean regarding colors
-for var in BLUE RED GREEN CYAN YELLOW MAGENTA WHITE ; unset $var
-builtin unset -v var
+builtin unset -v BLUE RED GREEN CYAN YELLOW MAGENTA WHITE
# "persistent history"
-# just write important commands you always need to ~/.important_commands
+# just write important commands you always need to $GRML_IMPORTANT_COMMANDS
+# defaults for backward compatibility to ~/.important_commands
if [[ -r ~/.important_commands ]] ; then
- fc -R ~/.important_commands
+ GRML_IMPORTANT_COMMANDS=~/.important_commands
+else
+ GRML_IMPORTANT_COMMANDS=${GRML_IMPORTANT_COMMANDS:-${ZDOTDIR:-${HOME}}/.important_commands}
fi
+[[ -r ${GRML_IMPORTANT_COMMANDS} ]] && builtin fc -R ${GRML_IMPORTANT_COMMANDS}
# load the lookup subsystem if it's available on the system
zrcautoload lookupinit && lookupinit
# general
#a2# Execute \kbd{du -sch}
-alias da='du -sch'
+[[ -n "$GRML_NO_SMALL_ALIASES" ]] || alias da='du -sch'
# listing stuff
#a2# Execute \kbd{ls -lSrah}
'*:Archive Or Uri:__archive_or_uri'
}
compdef _simple_extract simple-extract
-alias se=simple-extract
+[[ -n "$GRML_NO_SMALL_ALIASES" ]] || alias se=simple-extract
#f5# Change the xterm title from within GNU-screen
xtrename() {
alias hbp='hg-buildpackage'
# execute commands on the versioned patch-queue from the current repos
- alias mq='hg -R $(readlink -f $(hg root)/.hg/patches)'
+ [[ -n "$GRML_NO_SMALL_ALIASES" ]] || alias mq='hg -R $(readlink -f $(hg root)/.hg/patches)'
# diffstat for specific version of a mercurial repository
# hgstat => display diffstat between last revision and tip