diff --git a/plugins/osx/README.md b/plugins/osx/README.md index b77daecc..4e49feb3 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -24,6 +24,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) | `pfd` | Return the path of the frontmost Finder window | | `pfs` | Return the current Finder selection | | `cdf` | `cd` to the current Finder directory | +| `cdx` | `cd` to the current Xcode project directory | | `pushdf` | `pushd` to the current Finder directory | | `quick-look` | Quick-Look a specified file | | `man-preview` | Open a specified man page in Preview app | diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 95ef3e1a..9dfaf867 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -160,6 +160,15 @@ function pfs() { EOF } +function xcodeprojdir() { + dirname $(osascript 2>/dev/null </dev/null +} + function cdf() { cd "$(pfd)" } @@ -168,6 +177,10 @@ function pushdf() { pushd "$(pfd)" } +function cdx() { + cd "$(xcodeprojdir)" +} + function quick-look() { (( $# > 0 )) && qlmanage -p $* &>/dev/null & }