Added cd to active Xcode project to osx plugin

This commit is contained in:
drootang 2017-01-24 09:01:47 -05:00
parent d2725d44fc
commit 1f56eabbee
2 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
| `pfd` | Return the path of the frontmost Finder window | | `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection | | `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory | | `cdf` | `cd` to the current Finder directory |
| `cdx` | `cd` to the current Xcode project directory |
| `pushdf` | `pushd` to the current Finder directory | | `pushdf` | `pushd` to the current Finder directory |
| `quick-look` | Quick-Look a specified file | | `quick-look` | Quick-Look a specified file |
| `man-preview` | Open a specified man page in Preview app | | `man-preview` | Open a specified man page in Preview app |

View File

@ -160,6 +160,15 @@ function pfs() {
EOF EOF
} }
function xcodeprojdir() {
dirname $(osascript 2>/dev/null <<EOF
tell application "Xcode"
return path of active workspace document
end tell
EOF
) 2>/dev/null
}
function cdf() { function cdf() {
cd "$(pfd)" cd "$(pfd)"
} }
@ -168,6 +177,10 @@ function pushdf() {
pushd "$(pfd)" pushd "$(pfd)"
} }
function cdx() {
cd "$(xcodeprojdir)"
}
function quick-look() { function quick-look() {
(( $# > 0 )) && qlmanage -p $* &>/dev/null & (( $# > 0 )) && qlmanage -p $* &>/dev/null &
} }