Created
July 13, 2012 23:37
-
-
Save evansolomon/3108240 to your computer and use it in GitHub Desktop.
Command line one liner to find and open function definitions in Sublime Text 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alias ST2's command line tool for a shorter (easier-to-remember) name | |
alias st="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl" | |
# Search for an open Sublime Text to a function definition | |
function fx() { | |
ack "function &?$1\(" | awk {'print $1'} | sed 's/:$//g' | xargs st | |
} | |
# Example usage from the root of a WordPress repository | |
# fx wp_remote_get | |
# Automatically opens wp-includes/http.php to line 74 in Sublime Text 2 | |
# If the function is defined multiple times (e.g. methods of classes) it will open all of the files | |
# ...but only the last one will be on the correct line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment