forked from johnnybigoode-zz/solarized-dark-windows-git-bash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
49 lines (40 loc) · 1002 Bytes
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
function get_hostname {
export SHORTNAME=""
}
function user_color {
id | grep "Admin" > /dev/null
RETVAL=$?
if [[ $RETVAL == 0 ]]; then
usercolor="[0;32m";
else
usercolor="[0;32m";
fi
}
function settitle() {
u=${USERNAME}
h="$u@${HOSTNAME}"
echo -ne "\e]2;$h\a\e]1;$h\a";
}
# Set directory colors
eval `dircolors ~/.dir_colors`
# Set prompt and window title
inputcolor='[0;37m'
cwdcolor='[0;34m'
host_name='[1;31m'
user_color
PROMPT_COMMAND='settitle; get_hostname; history -a;'
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export the_branch="$(parse_git_branch)"
export PS1='\n\[\e${cwdcolor}\][$PWD]\[\e${usercolor}\][\u]\[\e${host_name}\]$(parse_git_branch) \[\e${inputcolor}\] λ '
# Aliases
alias ls='ls -l --color'
alias grep='grep -n --color'