Created
February 11, 2013 15:27
-
-
Save BenAtWide/4755110 to your computer and use it in GitHub Desktop.
Fish function to cd to frontmost finder window
This file contains 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
# jump straight to open finder window. Remember fish uses parentheses instead of backticks. | |
function cdf | |
set -l target (osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)') | |
if test $target != "" | |
cd "$target" | |
pwd | |
else | |
echo 'No Finder window found' >&2 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment