Created
July 15, 2019 21:12
-
-
Save bfatemi/e0497052c027678485098d727aa16f2a to your computer and use it in GitHub Desktop.
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
# Change directory to the current Finder directory | |
cdf() { | |
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 [ "$target" != "" ]; then | |
cd "$target"; pwd | |
else | |
echo 'No Finder window found' >&2 | |
fi | |
} | |
# Syntax highlighting in cat | |
cat() { | |
local out colored | |
out=$(/bin/cat $@) | |
colored=$(echo $out | pygmentize -f console -g 2>/dev/null) | |
[[ -n $colored ]] && echo "$colored" || echo "$out" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment