Last active
October 21, 2015 15:14
-
-
Save danramteke/3658683 to your computer and use it in GitHub Desktop.
useful bash configurations
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
RED="\033[0;31m" | |
YELLOW="\033[0;33m" | |
GREEN="\033[0;32m" | |
NO_COLOUR="\033[0m" | |
function parse_git_branch () { | |
git status -b --porcelain 2> /dev/null | head -1 | sed -e 's/## //' -e 's/\.\.\..*//' | |
} | |
function parse_git_color () { | |
if [ -n "`git status --porcelain 2>&1 | grep "fatal: Not a git repository"`" ] | |
then | |
echo -e "$NO_COLOUR" | |
elif [ -z "`git status --porcelain 2> /dev/null`" ] | |
then | |
echo -e "$GREEN" | |
elif [ -z "`git status --porcelain 2> /dev/null | grep -v -E "^[MARCD] .*$"`" ] | |
then | |
echo -e "$YELLOW" | |
else | |
echo -e "$RED" | |
fi | |
} | |
function parse_git_status () { | |
if [ -n "`git status --porcelain 2>&1 | grep "fatal: Not a git repository"`" ] | |
then | |
echo -e "" | |
elif [ -z "`git status --porcelain 2> /dev/null`" ] | |
then | |
echo -e "(`parse_git_branch`)" | |
elif [ -z "`git status --porcelain 2> /dev/null | grep -v -E "^[MARCD] .*$"`" ] | |
then | |
echo -e "{`parse_git_branch`}" | |
else | |
echo -e "<`parse_git_branch`>" | |
fi | |
} | |
export PS1="\[$GREEN\]\t\[$NO_COLOUR\]:\w \[\$(parse_git_color)\]\$(parse_git_status)\[$NO_COLOUR\]\$ " | |
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
[user] | |
email = [email protected] | |
name = Daniel R | |
[alias] | |
st = status | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
pr = pull --rebase | |
rso = remote show origin |
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
Show hidden characters
[ | |
{ "keys": ["super+shift+c"], "command": "copy_path" }, | |
{ "keys": ["super+shift+1"], "command": "reveal_in_side_bar"}, | |
{ "keys": ["super+alt+l"], "command": "reindent", "args": {"single_line": false}} | |
] |
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
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme", | |
"draw_white_space": "selection", | |
"trim_trailing_white_space_on_save": true, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"save_on_focus_lost": true, | |
"highlight_line": true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment