From 1f56eabbee436e8e7b9bd1b6db1b37d953a07f0b Mon Sep 17 00:00:00 2001 From: drootang Date: Tue, 24 Jan 2017 09:01:47 -0500 Subject: [PATCH] Added cd to active Xcode project to osx plugin --- plugins/osx/README.md | 1 + plugins/osx/osx.plugin.zsh | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index b77daecc5..4e49feb3c 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 95ef3e1aa..9dfaf8670 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 & }