From a4767da6801f91aae118662ef7d651d4baca40b5 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Sat, 17 Sep 2011 08:40:11 +0200 Subject: Add aliases to show/hide hidden files in Finder. Closes #15. --- .aliases | 4 ++++ .bash_prompt | 51 ++++++++++++++++++++++++++------------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/.aliases b/.aliases index 2604029..cb60eaa 100644 --- a/.aliases +++ b/.aliases @@ -44,6 +44,10 @@ alias fs="stat -f \"%z bytes\"" # ROT13-encode text. Works for decoding, too! ;) alias rot13='tr a-zA-Z n-za-mN-ZA-M' +# Show/hide hidden files in Finder +alias show="defaults write com.apple.Finder AppleShowAllFiles -bool true && killall Finder" +alias hide="defaults write com.apple.Finder AppleShowAllFiles -bool false && killall Finder" + # Disable Spotlight alias spotoff="sudo mdutil -a -i off" # Enable Spotlight diff --git a/.bash_prompt b/.bash_prompt index 764fdfc..639808d 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -6,36 +6,37 @@ elif infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color fi if tput setaf 1 &> /dev/null; then - tput sgr0 - if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then - MAGENTA=$(tput setaf 9) - ORANGE=$(tput setaf 172) - GREEN=$(tput setaf 190) - PURPLE=$(tput setaf 141) - WHITE=$(tput setaf 256) - else - MAGENTA=$(tput setaf 5) - ORANGE=$(tput setaf 4) - GREEN=$(tput setaf 2) - PURPLE=$(tput setaf 1) - WHITE=$(tput setaf 7) - fi - BOLD=$(tput bold) - RESET=$(tput sgr0) + tput sgr0 + if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then + MAGENTA=$(tput setaf 9) + ORANGE=$(tput setaf 172) + GREEN=$(tput setaf 190) + PURPLE=$(tput setaf 141) + WHITE=$(tput setaf 256) + else + MAGENTA=$(tput setaf 5) + ORANGE=$(tput setaf 4) + GREEN=$(tput setaf 2) + PURPLE=$(tput setaf 1) + WHITE=$(tput setaf 7) + fi + BOLD=$(tput bold) + RESET=$(tput sgr0) else - MAGENTA="\033[1;31m" - ORANGE="\033[1;33m" - GREEN="\033[1;32m" - PURPLE="\033[1;35m" - WHITE="\033[1;37m" - BOLD="" - RESET="\033[m" + MAGENTA="\033[1;31m" + ORANGE="\033[1;33m" + GREEN="\033[1;32m" + PURPLE="\033[1;35m" + WHITE="\033[1;37m" + BOLD="" + RESET="\033[m" fi -parse_git_dirty () { +function parse_git_dirty() { [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" } -parse_git_branch () { + +function parse_git_branch() { git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" } -- cgit v1.2.3