X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=64503c2d857666b3e51a205b605ebbd5cfea204d;hb=d0d83ab;hp=6ce77f57d2dc20209ee84579be90f6db8d51b8f7;hpb=37c121ea95764ec47f81247933bf67a540fdcd1e;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 6ce77f5..64503c2 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -134,7 +134,12 @@ is43(){ } is433(){ - [[ $ZSH_VERSION == 4.3.<3->* || $ZSH_VERSION == <5->* ]] && return 0 + [[ $ZSH_VERSION == 4.3.<3->* || $ZSH_VERSION == 4.<4->* || $ZSH_VERSION == <5->* ]] && return 0 + return 1 +} + +is439(){ + [[ $ZSH_VERSION == 4.3.<9->* || $ZSH_VERSION == 4.<4->* || $ZSH_VERSION == <5->* ]] && return 0 return 1 } @@ -276,6 +281,7 @@ setopt nobeep # avoid "beep"ing setopt pushd_ignore_dups # don't push the same dir twice. setopt noglobdots # * shouldn't match dotfiles. ever. setopt noshwordsplit # use zsh style word splitting +setopt unset # don't error out when unset parameters are used # }}} @@ -581,19 +587,6 @@ zle -N insert-unicode-char #k# Insert Unicode character bindkey '^Xi' insert-unicode-char -# just type 'cd ...' to get 'cd ../..' -# rationalise-dot() { -# if [[ $LBUFFER == *.. ]] ; then -# LBUFFER+=/.. -# else -# LBUFFER+=. -# fi -# } -# zle -N rationalise-dot -# bindkey . rationalise-dot - -# bindkey '\eq' push-line-or-edit - ## toggle the ,. abbreviation feature on/off # NOABBREVIATION: default abbreviation-state # 0 - enabled (default) @@ -630,6 +623,11 @@ zle -N slash-backward-kill-word #k# Kill everything in a word up to its last \kbd{/} bindkey '\ev' slash-backward-kill-word +# use the new *-pattern-* widgets for incremental history search +if is439 ; then + bindkey '^r' history-incremental-pattern-search-backward + bindkey '^s' history-incremental-pattern-search-forward +fi # }}} # a generic accept-line wrapper {{{ @@ -652,7 +650,7 @@ bindkey '\ev' slash-backward-kill-word zstyle ':acceptline:*' rehash true function Accept-Line() { - setopt localoptions noksharrays + emulate -L zsh local -a subs local -xi aldone local sub @@ -671,6 +669,7 @@ function Accept-Line() { } function Accept-Line-getdefault() { + emulate -L zsh local default_action zstyle -s ":acceptline:${alcontext}" default_action default_action @@ -685,7 +684,7 @@ function Accept-Line-getdefault() { } function accept-line() { - setopt localoptions noksharrays + emulate -L zsh local -a cmdline local -x alcontext local buf com fname format msg default_action @@ -1853,6 +1852,7 @@ vcs_info_printsys () { # {{{ } # }}} vcs_info_lastmsg () { # {{{ + emulate -L zsh local -i i VCS_INFO_maxexports @@ -1868,6 +1868,8 @@ vcs_info_lastmsg () { # {{{ } # }}} vcs_info () { # {{{ + emulate -L zsh + setopt extendedglob local pat local -i found local -a VCSs disabled dps @@ -2136,7 +2138,7 @@ alias rm='nocorrect rm' # no spelling correction on rm #a1# Execute \kbd{rmdir} alias rd='rmdir' -#a1# Execute \kbd{rmdir} +#a1# Execute \kbd{mkdir} alias md='mkdir' # see http://www.cl.cam.ac.uk/~mgk25/unicode.html#term for details @@ -2171,7 +2173,6 @@ swspeak() { export PS1="%m%# " /usr/sbin/swspeak-setup $@ else # old version: - aumix -w 90 -v 90 -p 90 -m 90 if ! [[ -r /dev/softsynth ]] ; then flite -o play -t "Sorry, software synthesizer not available. Did you boot with swspeak bootoption?" return 1 @@ -2338,12 +2339,17 @@ if check_com -c grep-status ; then fi # if cdrecord is a symlink (to wodim) or isn't present at all warn: -if [[ -L /usr/bin/cdrecord ]] || ! check_com -c cdrecord ; then - if check_com -c wodim ; then - alias cdrecord="echo 'cdrecord is not provided under its original name by Debian anymore. +if [[ -L /usr/bin/cdrecord ]] || ! check_com -c cdrecord; then + if check_com -c wodim; then + cdrecord() { + cat <\n' "ssh-cert-${sh}" + return 1 + fi + openssl x509 -noout -fingerprint -${sh} -in $1 + } +done; unset sh + +ssl-cert-fingerprints() { + emulate -L zsh + local i + if [[ -z $1 ]] ; then + printf 'usage: ssl-cert-fingerprints \n' + return 1 + fi + for i in ${ssl_hashes} + do ssl-cert-$i $1; + done +} + +ssl-cert-info() { + emulate -L zsh + if [[ -z $1 ]] ; then + printf 'usage: ssl-cert-info \n' + return 1 + fi + openssl x509 -noout -text -in $1 + ssl-cert-fingerprints $1 +} + # }}} # {{{ make sure our environment is clean regarding colors @@ -3060,20 +3108,6 @@ alias CO="./configure" #a2# Execute \kbd{./configure --help} alias CH="./configure --help" -# arch/tla stuff -if check_com -c tla ; then - #a2# Execute \kbd{tla what-changed --diffs | less} - alias tdi='tla what-changed --diffs | less' - #a2# Execute \kbd{tla-buildpackage} - alias tbp='tla-buildpackage' - #a2# Execute \kbd{tla archive-mirror} - alias tmi='tla archive-mirror' - #a2# Execute \kbd{tla commit} - alias tco='tla commit' - #a2# Execute \kbd{tla star-merge} - alias tme='tla star-merge' -fi - # listing stuff #a2# Execute \kbd{ls -lSrah} alias dir="ls -lSrah" @@ -3084,7 +3118,7 @@ alias lsa='ls -a .*(.)' # only show dot-files #a2# Only files with setgid/setuid/sticky flag alias lss='ls -l *(s,S,t)' # only files with setgid/setuid/sticky flag #a2# Only show 1st ten symlinks -alias lsl='ls -l *(@[1,10])' # only symlinks +alias lsl='ls -l *(@)' # only symlinks #a2# Display only executables alias lsx='ls -l *(*)' # only executables #a2# Display world-{readable,writable,executable} files @@ -3116,8 +3150,6 @@ alias r-x='chmod 755' #a2# Execute \kbd{mkdir -o} alias md='mkdir -p' -check_com -c ipython && alias ips='ipython -p sh' - # console stuff #a2# Execute \kbd{mplayer -vo fbdev} alias cmplayer='mplayer -vo fbdev' @@ -3136,12 +3168,6 @@ check_com -c python && alias http="python -m SimpleHTTPServer" # Use 'g' instead of 'git': check_com g || alias g='git' -# check whether Debian's package management (dpkg) is running -if check_com salias ; then - #a2# Check whether a dpkg instance is currently running - salias check_dpkg_running="dpkg_running" -fi - # work around non utf8 capable software in utf environment via $LANG and luit if check_com isutfenv && check_com luit ; then if check_com -c mrxvt ; then @@ -3311,7 +3337,11 @@ disassemble(){ } #f5# Firefox remote control - open given URL fir() { - firefox -a firefox -remote "openURL($1)" + if [ -e /etc/debian_version ]; then + firefox -a iceweasel -remote "openURL($1)" || firefox ${1}& + else + firefox -a firefox -remote "openURL($1)" || firefox ${1}& + fi } #f5# Create Directoy and \kbd{cd} to it mcd() { @@ -3385,7 +3415,7 @@ limg() { if [[ $#images -eq 0 ]] ; then print "No image files found" else - ls "$@" "$images[@]" + ls "$images[@]" fi } @@ -3642,19 +3672,8 @@ ansi-colors() { done } -# suidfind() { ls -latg $path | grep '^...s' } #f5# Find all files in \$PATH with setuid bit set -suidfind() { ls -latg $path/*(sN) } - -# See above but this is /better/ ... anywise .. -findsuid() { - print 'Output will be written to ~/suid_* ...' - $SUDO find / -type f \( -perm -4000 -o -perm -2000 \) -ls > ~/suid_suidfiles.`date "+%Y-%m-%d"`.out 2>&1 - $SUDO find / -type d \( -perm -4000 -o -perm -2000 \) -ls > ~/suid_suiddirs.`date "+%Y-%m-%d"`.out 2>&1 - $SUDO find / -type f \( -perm -2 -o -perm -20 \) -ls > ~/suid_writefiles.`date "+%Y-%m-%d"`.out 2>&1 - $SUDO find / -type d \( -perm -2 -o -perm -20 \) -ls > ~/suid_writedirs.`date "+%Y-%m-%d"`.out 2>&1 - print 'Finished' -} +suidfind() { ls -latg $path | grep '^...s' } # TODO: So, this is the third incarnation of this function!? #f5# Reload given functions @@ -4384,15 +4403,11 @@ if (( GRMLSMALL_SPECIFIC > 0 )) && isgrmlsmall ; then unset abk[V] unalias 'V' &> /dev/null unfunction vman &> /dev/null - unfunction vimpm &> /dev/null - unfunction vimhelp &> /dev/null unfunction viless &> /dev/null unfunction 2html &> /dev/null # manpages are not in grmlsmall unfunction manzsh &> /dev/null - unalias man2 &> /dev/null - unalias man &> /dev/null unfunction man2 &> /dev/null fi @@ -4413,3 +4428,6 @@ zrclocal ## END OF FILE ################################################################# # vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4 +# Local variables: +# mode: sh +# End: