# ------------------------------------------------------------------------------ # FILE: osx.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. # AUTHORS: sorin-ionescu # benlangfeld # robbyrussell # betawaffle # rgm # VERSION: 1.0.2 # ------------------------------------------------------------------------------ function tab() { local command="cd \\\"$PWD\\\"" (( $# > 0 )) && command="${command}; $*" the_app=$( osascript 2>/dev/null </dev/null </dev/null </dev/null </dev/null < 0 )) && qlmanage -p $* &>/dev/null & } function man-preview() { man -t "$@" | open -f -a Preview } function trash() { local trash_dir="${HOME}/.Trash" local temp_ifs=$IFS IFS=$'\n' for item in "$@"; do if [[ -e "$item" ]]; then item_name="$(basename $item)" if [[ -e "${trash_dir}/${item_name}" ]]; then mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")" else mv -f "$item" "${trash_dir}/" fi fi done IFS=$temp_ifs } if [[ $TERM_PROGRAM == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then autoload -U add-zsh-hook function lion_resume_chpwd { # add support for OS X Lion window resume on Terminal.app relaunch # straight port from /etc/bashrc on Lion local SEARCH=' ' local REPLACE='%20' local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}" printf '\e]7;%s\a' "$PWD_URL" } add-zsh-hook chpwd lion_resume_chpwd fi