-
Notifications
You must be signed in to change notification settings - Fork 1
/
.zshrc
155 lines (127 loc) · 3.88 KB
/
.zshrc
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="ys"
alias cup='composer update'
alias cin='composer install'
alias ccat='pygmentize -O style=monokai -f console256 -g'
alias cdt='cd ~/code/ticketing/'
alias cdd='cd ~/code/desk/'
alias g=git
if [ -x "$(command -v nvim)" ]; then
alias v='nvim .'
export VISUAL=nvim
export EDITOR="$VISUAL"
else
alias v='vim .'
fi
alias upython='ipython -i ~/.ipythonrc.py'
alias pip='pip --trusted-host devpi.mapado.com'
_symfony_console () {
echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)"
}
alias sfcc='$(_symfony_console) cache:clear'
# update_auth_sock() {
# local socket_path="$(tmux show-environment | sed -n 's/^SSH_AUTH_SOCK=//p')"
#
# if ! [[ "$socket_path" ]]; then
# echo 'no socket path' >&2
# return 1
# else
# export SSH_AUTH_SOCK="$socket_path"
# fi
# }
#
# update_auth_sock
function git-branch-delete {
if [ ! -d .git ]
then
echo "${fg[green]}Not a Git Repository${reset_color}"
return
fi
currentbranch=`git branch | grep "^* " | sed "s/* //"`
mainbranch="master"
git rev-parse --verify master > /dev/null 2> /dev/null
if [ $? -eq 0 ]
then
# master branch does exists
else
# master branch does not exist, test "main"
git rev-parse --verify main > /dev/null 2> /dev/null
if [ $? -eq 0 ]
then
# main branch does exists
mainbranch="main"
else
# main branch does not exist, test "main"
echo "${fg[red]}Neither main or master branch exists${reset_color}"
return
fi
fi
if [ $1 ]
then
todelbranch=$1
gotobranch=$currentbranch
else
todelbranch=$currentbranch
gotobranch=$mainbranch
fi
if [ "$todelbranch" = $mainbranch ]
then
echo "${fg[green]}You can not delete branch $mainbranch${reset_color}"
return
fi
git checkout $mainbranch
git fetch --prune
git merge origin/$mainbranch
git branch -d $todelbranch
git push origin --delete $todelbranch
git checkout $gotobranch
}
stty -ixon
# Add local path
export PATH=~/.local/bin/:$PATH
if [ -x "$(command -v npm)" ] || [ -x "$(command -v yarn)" ]; then
export PATH=$PATH:./node_modules/.bin
fi
if [ -x "$(command -v composer)" ]; then
export PATH=$PATH:~/.composer/$(composer global config bin-dir 2> /dev/null)
export PATH=./bin:./vendor/bin:$PATH
fi
if [ -d ~/bin/android-sdk-linux/ ]; then
export ANDROID_HOME=~/bin/android-sdk-linux/
export PATH=$PATH:~/bin/android-sdk-linux/tools
export PATH=$PATH:~/bin/android-sdk-linux/platform-tools
fi
if [ -f ~/.zshaliases ]; then
source ~/.zshaliases
fi
#
export VAGRANT_DEFAULT_PROVIDER=virtualbox
export REACT_EDITOR=vim
# zstyle :omz:plugins:ssh-agent lifetime 4h
# zstyle :omz:plugins:ssh-agent identities id_ed25519
plugins=(symfony2 zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# GPG key, copied from https://help.github.com/articles/telling-git-about-your-gpg-key/
export GPG_TTY=$(tty)
# In order for gpg to find gpg-agent, gpg-agent must be running,
# and there must be an env variable pointing GPG to the gpg-agent socket.
# This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever),
# will either start gpg-agent or set up the
# GPG_AGENT_INFO variable if it's already running.
# Add the following
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
eval $(gpg-agent --daemon)
fi
if [ "$ASCIINEMA_REC" = "1" ]; then
export PS1='$ '
fi
# Use local file for specific configuration
if [ -f ~/.zshrc.local ]; then
source ~/.zshrc.local
fi
# Fixes issue with VSCode. See https://github.com/microsoft/vscode/issues/168396#issuecomment-1343000046
HISTFILE="$HOME/.zhistory"