X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=cf20ca75e9a202a0bc5b68aea4e119c29ec4019b;hb=aad6e4ee9274c7d0ed98d50ced3c9795cd48fb9c;hp=241030451e2d8c99750404fa3802bb4d02caf9f7;hpb=e82bb71fc732483b11b875a725677a4724851422;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 2410304..cf20ca7 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -103,14 +103,6 @@ # *all* aliases, for example, use @@INSERT-aliases-all@@. #}}} -# Only load once -[[ ${(t)GRML} != *association* ]] && typeset -gA GRML -if (( ${GRML[ZSHRC_LOADED]} )); then - return 0 -else - GRML[ZSHRC_LOADED]=1 -fi - # zsh profiling {{{ # just execute 'ZSH_PROFILE_RC=1 zsh' and run 'zprof' to get the details if [[ $ZSH_PROFILE_RC -gt 0 ]] ; then @@ -1305,7 +1297,7 @@ function info_print () { is4 && [[ $NOPRECMD -eq 0 ]] && precmd () { [[ $NOPRECMD -gt 0 ]] && return 0 # update VCS information - vcs_info + (( ${+functions[vcs_info]} )) && vcs_info if [[ $TERM == screen* ]] ; then if [[ -n ${vcs_info_msg_1_} ]] ; then @@ -2066,8 +2058,15 @@ if [[ -d /etc/init.d || -d /etc/service ]] ; then fi } + _grmlinitd() { + local -a scripts + scripts=( /etc/init.d/*(x:t) ) + _describe "service startup script" scripts + } + for i in Start Restart Stop Force-Reload Reload ; do eval "$i() { __start_stop $i \"\$1\" \"\$2\" ; }" + compdef _grmlinitd $i done fi @@ -2656,6 +2655,17 @@ fir() { firefox -a firefox -remote "openURL($1)" || firefox ${1}& fi } +# smart cd function, allows switching to /etc when running 'cd /etc/fstab' +cd() { + if [[ -f ${1} ]]; then + [[ ! -e ${1:h} ]] && return 1 + print "Correcting ${1} to ${1:h}" + builtin cd ${1:h} + else + builtin cd ${1} + fi +} + #f5# Create Directoy and \kbd{cd} to it mcd() { mkdir -p "$@" && cd "$@"