From de14a7c00d25114ae8e4edefc1dbc1f22013522e Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 25 Jan 2022 17:22:41 -0800 Subject: [PATCH] [zsh] Open xcodeproj and xcworkspace files by looking for the currently selected Xcode --- zsh/func/init_rc_darwin | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zsh/func/init_rc_darwin b/zsh/func/init_rc_darwin index de75d4f..889057c 100644 --- a/zsh/func/init_rc_darwin +++ b/zsh/func/init_rc_darwin @@ -37,5 +37,14 @@ function finder { open -R "$1" } +function open-xcode { + local selectedXcode=`xcode-select -p` + while [[ ! `basename $selectedXcode` =~ ".app$" ]]; do + selectedXcode=`dirname "$selectedXcode"` + done + open -a "$selectedXcode" $@ +} + alias -s app='open' -alias -s xcodeproj='open -a Xcode' +alias -s xcodeproj='open-xcode' +alias -s xcworkspace='open-xcode'