-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
137 lines (109 loc) · 3.5 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
# Allow autocompletion
autoload -Uz compinit promptinit
compinit
promptinit
# Arrow-key driven autocompletion
zstyle ':completion:*' menu select
setopt COMPLETE_ALIASES
# for colors :c
autoload -Uz colors
colors
# nix ui
. /home/geox/.nix-profile/etc/profile.d/nix.sh
# load vcc for git
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
# to use prompt
RPROMPT='%F{blue}[%F{red}${vcs_info_msg_0_}%F{blue}]%f '
setopt prompt_subst
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr ' *'
zstyle ':vcs_info:*' stagedstr ' +'
zstyle ':vcs_info:git:*' formats '%b%u%c'
zstyle ':vcs_info:git:*' actionformats '(%b|%a%u%c)'
# Mode vim
bindkey -v
# :peeposhy:
prompt adam2
# ugly but menfou
eval $(ssh-agent)
# Start Docker daemon automatically when logging in if not running.
RUNNING=`ps aux | grep dockerd | grep -v grep`
if [ -z "$RUNNING" ]; then
sudo dockerd > /dev/null 2>&1 &
disown
fi
# ls colors
eval $(dircolors -p | sed -e 's/DIR 01;34/DIR 01;35/' | dircolors /dev/stdin)
alias ghc='ghc -dynamic'
alias dr='dune runtest'
alias dp='dune promote'
alias ls='ls --color=auto'
alias '..'='cd ..'
alias gs='git status'
alias ga='git add'
alias gc='git commit -m'
alias gl='git lg'
alias gd='git diff'
alias gp='git push'
alias gpt='git push --follow-tags'
alias gs='git status'
alias glh='git lg | head'
alias trish='python /tmp/pip-req-build-ymj_jvld/trish.py'
alias GCC='gcc -Wall -Wextra -Werror -std=c99 -pedantic'
DISABLE_LS_COLORS=false
# Output tags in a readable format
taga () {
git show-ref -d --tags |
cut -b 42- |
sort |
sed 's/\^{}//' |
uniq -c |
sed 's/2\ refs\/tags\// A: /' |
sed 's/1\ refs\/tags\//LW: /'
}
branch_rename() {
[ "$#" -ne 2 ] && echo "Usage: branch_rename old_name new_name" && exit 1;
#_name=$(git rev-parse --abbrev-ref HEAD);
_name = $1
git branch -m "$_name" "$2";
git push origin --delete "$_name";
git branch --unset-upstream "$2";
git push origin "$2";
git push origin -u "$2"
}
# check if wdir is a git repository and has a clang-format configuration
# if it has one, runs clang-format on .c and .h files.
# otherwise try to cp one from $HOME
die() {
printf "\033[0;31m${@}\033[0m\n"
exit 1
}
clfe() {
repo="$(git rev-parse --show-toplevel 2>/dev/null)"
if test "$?" -ne 0; then
die "You must run this script from the work tree of a git repository"
fi
clang_format_file="${repo}/.clang-format"
if ! test -f "${clang_format_file}"; then
echo "Failed to find clang-format configuration at ${clang_format_file}"
echo "Trying to cp $HOME/.clang-format ..."
if ! test -f "$HOME/.clang-format"; then
die "Failed to find clang-format configuration in $HOME"
fi
cp "$HOME/.clang-format" "$repo" && echo "Successfully copied .clang-format"
fi
find "$repo" -type f -name '*.[ch]' -exec clang-format --style=file -i {} ';' &&
echo "Finished executing clang-format configuration."
}
# Set up serverx
export DISPLAY=$(ip route | awk '/^default/{print $3; exit}'):0.0
export LIBGL_ALWAYS_INDIRECT=1
FLAGS() {
echo "-Wall -Wextra -Werror -std=c99 -pedantic"
}
# opam configuration
[[ ! -r /home/geox/.opam/opam-init/init.zsh ]] || source /home/geox/.opam/opam-init/init.zsh > /dev/null 2> /dev/null
if [ -e /home/geox/.nix-profile/etc/profile.d/nix.sh ]; then . /home/geox/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
# eval "$(starship init zsh)"