From c3ab312a7ccdcf05dd3d7a90375dea646aed62c7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 22 Feb 2011 23:32:50 -0500 Subject: [PATCH] Vastly improved osx plugin. --- plugins/osx/osx.plugin.zsh | 130 ++++++++++++++++++++++++------------- 1 file changed, 86 insertions(+), 44 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 81eed5e9..62f7ccd7 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,57 +1,99 @@ -function savepath() { - pwd > ~/.current_path~ -} +# ------------------------------------------------------------------------------ +# FILE: osx.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.1 +# ------------------------------------------------------------------------------ + function tab() { -savepath -osascript >/dev/null < 0 )) && command="${command}; $*" + + the_app=$( + osascript 2>/dev/null </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 +} +