-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
109 lines (93 loc) · 2.21 KB
/
zshrc
File metadata and controls
109 lines (93 loc) · 2.21 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
## Imports
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
## EXPORTS
export EDITOR=/usr/local/bin/vim
export PATH=~/environment/bin:/opt/local/bin:~/bin:$PATH
export FZF_DEFAULT_COMMAND='rg --files .'
export HISTCONTROL=ignoredups
## FUNCTIONS
function f() {
find . -name "*${1}*"
}
function virg() {
files="`rg $1 -l`"
vi -p $files
}
function format_check()
{
checknotes
echo "Do you want to run formatter? (y/N)"
read VALUE
case $VALUE in
"Y" )
formatter
;;
"y" )
formatter
;;
esac
echo
echo "--------------------------"
git s; read
gitall
}
function push_check()
{
BRANCH_NAME="$(git branch -vv | grep '^\*')"
echo "${BRANCH_NAME}"
echo "Push? (y/N)"
read VALUE
case $VALUE in
"Y" )
git push
;;
"y" )
git push
;;
esac
}
## ALIASES
alias ls='ls -G'
alias ll='ls -l'
alias vi='nvim -u ~/.vimrc'
alias notecheck=checknotes
alias workcheck=checkwork
## Git
alias gc='format_check; git commit'
alias gcrev='gc -m"Code review"; push_check'
alias gcam='gc --amend'
alias gcwip='git commit -m"WIP"'
alias gcfix='gc -m"Fix"; push_check'
alias gt='git t'
alias gs='git s'
alias grm='git fetch --all; git rebase --interactive origin/master'
function gtm()
{
BRANCHES="$(git branch | awk '{ print $NF }')"
gt ${BRANCHES}
}
## PROMPT
git_color()
{
local git_status="$(git status 2> /dev/null)"
if [[ $git_status =~ "Changes to be committed" ]]; then
echo -e "\033[0;32m" # green
elif [[ $git_status =~ "have diverged" ]]; then
echo -e "\033[0;37m" # gray
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
echo -e "\033[0;37m" # gray
elif [[ ! $git_status =~ "working tree clean" ]]; then
echo -e "\033[0;31m" # red
elif [[ $git_status =~ "nothing to commit" ]]; then
echo -e "\033[0;34m" # blue
else
echo -e "\033[0;33m" # yellow
fi
}
git_prompt() {
echo "\$(git_color)"'$(__git_ps1)'
}
source ~/environment/scripts/git-prompt.sh
FIRST_LINE="%F{green}%n@%m %F{yellow}%~ $(git_color)$(__git_ps1)"
SECOND_LINE="%F{none}o/ "
PROMPT=$'\n'"$FIRST_LINE"$'\n'"$SECOND_LINE"