Skip to content

Instantly share code, notes, and snippets.

@dunkelstern
Created March 30, 2012 10:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dunkelstern/2250729 to your computer and use it in GitHub Desktop.
Save dunkelstern/2250729 to your computer and use it in GitHub Desktop.
xed "reimplementation" to fix broken Xcode 4 xed
#!/bin/bash
if [ "$1" = "-l" ] || [ "$1" = "--line" ] ; then
line=$2
file=$3
else
line=1
file=$1
fi
osascript &>/dev/null <<EOF
tell application "Xcode"
open "$file"
activate
tell application "System Events"
tell process "Xcode"
keystroke "l" using command down
repeat until window "Jump" exists
end repeat
click text field 1 of window "Jump"
set value of text field 1 of window "Jump" to "$line"
keystroke return
end tell
end tell
end tell
EOF
@dunkelstern
Copy link
Author

Warning:

  • no error checking,
  • crude commandline parsing
  • not the full functionality of the original xed
  • "Jump in 'filename.m'" in the "Navigate" Menu in Xcode must have command+L as shortcut
  • Universal Access has to be turned on for this to work

@irlabs
Copy link

irlabs commented Nov 11, 2016

In new versions of Xcode, the "Jump" window is now called "Open Quickly". With that change this script works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment