X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=b7cb2e5f353210b6dc0b74df7188ec35b5159644;hb=78d890c776564875326d0ab41e8ed80ee1c6c0ab;hp=1019445d77516fc69feccb28f4089b819fd18ab0;hpb=6472d2d7de5cbfa1f20961bde71239c793bcb15c;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 1019445..b7cb2e5 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -179,6 +179,11 @@ isdarwin(){ return 1 } +isfreebsd(){ + [[ $OSTYPE == freebsd* ]] && return 0 + return 1 +} + #f1# are we running within an utf environment? isutfenv() { case "$LANG $CHARSET $LANGUAGE" in @@ -533,8 +538,9 @@ export SHELL='/bin/zsh' # color setup for ls: check_com -c dircolors && eval $(dircolors -b) -# color setup for ls on OS X: +# color setup for ls on OS X / FreeBSD: isdarwin && export CLICOLOR=1 +isfreebsd && export CLICOLOR=1 # do MacPorts setup on darwin if isdarwin && [[ -d /opt/local ]]; then @@ -963,7 +969,6 @@ if zrcautoload compinit ; then compinit || print 'Notice: no compinit available :(' else print 'Notice: no compinit available :(' - function zstyle { } function compdef { } fi @@ -1705,6 +1710,15 @@ grmlcomp() { zstyle ':completion:*:manuals.*' insert-sections true zstyle ':completion:*:man:*' menu yes select + # Search path for sudo completion + zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \ + /usr/local/bin \ + /usr/sbin \ + /usr/bin \ + /sbin \ + /bin \ + /usr/X11R6/bin + # provide .. as a completion zstyle ':completion:*' special-dirs .. @@ -2150,9 +2164,11 @@ deswap() { # VIM_OPTIONS=( -p ) # This will cause vim to send every file given on the # commandline to be send to it's own tab (needs vim7). -vim() { - VIM_PLEASE_SET_TITLE='yes' command vim ${VIM_OPTIONS} "$@" -} +if check_com vim; then + vim() { + VIM_PLEASE_SET_TITLE='yes' command vim ${VIM_OPTIONS} "$@" + } +fi # make a backup of a file bk() { @@ -2420,62 +2436,62 @@ simple-extract() { zparseopts -D -E "d=DELETE_ORIGINAL" for ARCHIVE in "${@}"; do case $ARCHIVE in - *.(tar.bz2|tbz2|tbz)) + *(tar.bz2|tbz2|tbz)) DECOMP_CMD="tar -xvjf -" USES_STDIN=true USES_STDOUT=false ;; - *.(tar.gz|tgz)) + *(tar.gz|tgz)) DECOMP_CMD="tar -xvzf -" USES_STDIN=true USES_STDOUT=false ;; - *.(tar.xz|txz|tar.lzma)) + *(tar.xz|txz|tar.lzma)) DECOMP_CMD="tar -xvJf -" USES_STDIN=true USES_STDOUT=false ;; - *.tar) + *tar) DECOMP_CMD="tar -xvf -" USES_STDIN=true USES_STDOUT=false ;; - *.rar) + *rar) DECOMP_CMD="unrar x" USES_STDIN=false USES_STDOUT=false ;; - *.lzh) + *lzh) DECOMP_CMD="lha x" USES_STDIN=false USES_STDOUT=false ;; - *.7z) + *7z) DECOMP_CMD="7z x" USES_STDIN=false USES_STDOUT=false ;; - *.(zip|jar)) + *(zip|jar)) DECOMP_CMD="unzip" USES_STDIN=false USES_STDOUT=false ;; - *.deb) + *deb) DECOMP_CMD="ar -x" USES_STDIN=false USES_STDOUT=false ;; - *.bz2) + *bz2) DECOMP_CMD="bzip2 -d -c -" USES_STDIN=true USES_STDOUT=true ;; - *.(gz|Z)) + *(gz|Z)) DECOMP_CMD="gzip -d -c -" USES_STDIN=true USES_STDOUT=true ;; - *.(xz|lzma)) + *(xz|lzma)) DECOMP_CMD="xz -d -c -" USES_STDIN=true USES_STDOUT=true