Last active
August 29, 2015 14:01
-
-
Save fschaper/43460547ccd950a74e6c to your computer and use it in GitHub Desktop.
bash_profile configuration for os x
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
# OSX: cd's to frontmost window of Finder | |
# eg; change finder directory | |
cdf() { | |
currFolderPath=$( /usr/bin/osascript <<EOT | |
tell application "Finder" | |
try | |
set currFolder to (folder of the front window as alias) | |
on error | |
set currFolder to (path to desktop folder as alias) | |
end try | |
POSIX path of currFolder | |
end tell | |
EOT | |
) | |
cd "$currFolderPath" | |
} | |
# GIT Konfiguration | |
GIT_THEME_PROMPT_DIRTY='*' | |
function git_terminal_tab_name() { | |
projectDirName=$(basename $(git rev-parse --show-toplevel 2> /dev/null) 2> /dev/null || echo 'bash' ) | |
echo -n -e "\033]0;$projectDirName\007" | |
} | |
function git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo -e " (\033[35m${ref#refs/heads/}\033[1;36m$(parse_git_dirty)\033[0m)" | |
} | |
function parse_git_dirty { | |
if [[ -n $(git status -s 2> /dev/null |grep -v ^# | grep -v "working directory clean" ) ]]; then | |
echo -e "$GIT_THEME_PROMPT_DIRTY" | |
else | |
echo -e "$GIT_THEME_PROMPT_CLEAN" | |
fi | |
} | |
function prompt() { | |
local BLACK="\[\033[0;30m\]" | |
local BLACKBOLD="\[\033[1;30m\]" | |
local RED="\[\033[0;31m\]" | |
local REDBOLD="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local GREENBOLD="\[\033[1;32m\]" | |
local YELLOW="\[\033[0;33m\]" | |
local YELLOWBOLD="\[\033[1;33m\]" | |
local BLUE="\[\033[0;34m\]" | |
local BLUEBOLD="\[\033[1;34m\]" | |
local PURPLE="\[\033[0;35m\]" | |
local PURPLEBOLD="\[\033[1;35m\]" | |
local CYAN="\[\033[0;36m\]" | |
local CYANBOLD="\[\033[1;36m\]" | |
local WHITE="\[\033[0;37m\]" | |
local WHITEBOLD="\[\033[1;37m\]" | |
local RESET="\[\033[00m\]" | |
export PS1="$GREEN\! $CYAN\u$YELLOWBOLD@$PURPLEBOLD\h$YELLOWBOLD\w$RESET\$(git_prompt_info)\$(git_terminal_tab_name)$ " | |
} | |
prompt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment