-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc_cygwin
86 lines (74 loc) · 2.03 KB
/
.bashrc_cygwin
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
alias clear=cls
alias ll='ls -l --color'
alias ls='ls -G --color'
alias la='ls -a -G --color'
alias l='ls -al -G --color'
alias lt='ls -alrt -G --color'
alias c='clear'
alias open='cygstart'
alias cdg='cd ~/projectsgit'
export LS_COLORS='no=00:fi=00:di=00;36:ln=00;35:ex=00;92'
export TERM=xterm-256color
function start_visualstudio
{
if [[ $1 != "" ]]; then
cygstart $1
echo "starting visual studio with "$1
return
fi
cygstart *.sln > /dev/null 2>&1
if [[ $? != 0 ]]; then
cygstart src/*.sln > /dev/null 2>&1
fi
if [[ $? != 0 ]]; then
echo "No project file found"
return
fi
}
alias vs=start_visualstudio
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[1;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
function parse_git_branch {
git rev-parse --git-dir &> /dev/null
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="${RED}Z"
fi
# add an else if or two here if you want to get more specific
if [[ ${git_status} =~ ${remote_pattern} ]]; then
if [[ ${BASH_REMATCH[1]} == "ahead" ]]; then
remote="${YELLOW}^"
else
remote="${YELLOW}v"
fi
fi
if [[ ${git_status} =~ ${diverge_pattern} ]]; then
remote="${YELLOW}^v"
fi
if [[ ${git_status} =~ ${branch_pattern} ]]; then
branch=${BASH_REMATCH[1]}
echo " (${branch})${remote}${state}"
fi
}
function prompt_func() {
previous_return_value=$?;
# prompt="${TITLEBAR}$BLUE[$RED\w$GREEN$(__git_ps1)$YELLOW$(git_dirty_flag)$BLUE]$COLOR_NONE "
prompt="${TITLEBAR}${BLUE}[${RED}\w${GREEN}$(parse_git_branch)${BLUE}]${COLOR_NONE} "
if test $previous_return_value -eq 0
then
PS1="${prompt}➔ "
else
PS1="${prompt}${RED}➔${COLOR_NONE} "
fi
}
PROMPT_COMMAND=prompt_func