aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2013-04-16 16:35:38 +0200
committerMathias Bynens <mathias@qiwi.be>2013-04-16 16:35:38 +0200
commitfa14911e953f0d2c8db43538647c9413cca2d5a3 (patch)
treecc1a57eaf8b20b7c1192296e199fd1c2b192f495
parentf0944c7be79888fc7e6c422795631de77c357778 (diff)
downloaddotfiles-fa14911e953f0d2c8db43538647c9413cca2d5a3.tar.gz
dotfiles-fa14911e953f0d2c8db43538647c9413cca2d5a3.tar.bz2
dotfiles-fa14911e953f0d2c8db43538647c9413cca2d5a3.zip
.functions: Add `cdf`
`cdf` changes the working directory to the top-most Finder window location. Thanks to @sindresorhus and @paulirish!
-rw-r--r--.functions5
1 files changed, 5 insertions, 0 deletions
diff --git a/.functions b/.functions
index 90373ae..001e3d9 100644
--- a/.functions
+++ b/.functions
@@ -21,6 +21,11 @@ function mkd() {
mkdir -p "$@" && cd "$@"
}
+# Change working directory to the top-most Finder window location
+function cdf() { # short for `cdfinder`
+ cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"
+}
+
# Determine size of a file or total size of a directory
function fs() {
if du -b /dev/null > /dev/null 2>&1; then