]>
git.rmz.io Git - dotfiles.git/blob - zsh/plugins/osx/osx.plugin.zsh
1 # ------------------------------------------------------------------------------
3 # DESCRIPTION: oh-my-zsh plugin file.
4 # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
6 # ------------------------------------------------------------------------------
10 local command="cd \\\"$PWD\\\""
11 (( $# > 0 )) && command="${command}; $*"
14 osascript
2>/dev
/null
<<EOF
15 tell application "System Events"
16 name of first item of (every process whose frontmost is true)
21 [[ "$the_app" == 'Terminal' ]] && {
22 osascript
2>/dev
/null
<<EOF
23 tell application "System Events"
24 tell process "Terminal" to keystroke "t" using command down
25 tell application "Terminal" to do script "${command}" in front window
30 [[ "$the_app" == 'iTerm' ]] && {
31 osascript
2>/dev
/null
<<EOF
32 tell application "iTerm"
33 set current_terminal to current terminal
35 launch session "Default Session"
36 set current_session to current session
38 write text "${command}"
47 osascript
2>/dev
/null
<<EOF
48 tell application "Finder"
49 return POSIX path of (target of window 1 as alias)
55 osascript
2>/dev
/null
<<EOF
57 tell application "Finder" to set the_selection to selection
58 set item_count to count the_selection
59 repeat with item_index from 1 to count the_selection
60 if item_index is less than item_count then set the_delimiter to "\n"
61 if item_index is item_count then set the_delimiter to ""
62 set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter
75 function quick
-look() {
76 (( $# > 0 )) && qlmanage
-p $
* &>/dev
/null
&
79 function man
-preview() {
80 man
-t "$@" | open
-f -a Preview
84 local trash_dir
="${HOME}/.Trash"
88 if [[ -e "$item" ]]; then
89 item_name
="$(basename $item)"
90 if [[ -e "${trash_dir}/${item_name}" ]]; then
91 mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")"
93 mv -f "$item" "${trash_dir}/"