-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
104 lines (89 loc) · 2.08 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
#!/usr/bin/env zsh
bindkey -e # Enable control-A/E etc. when EDITOR set to vim.
bindkey "^[[3~" delete-char # Fix delete key.
setopt interactivecomments # Allow comments in interactive shell.
# Make zsh tab-completion behave more like bash.
#setopt autolist
unsetopt autolist
unsetopt menucomplete
#setopt noautomenu
bindkey "^F" forward-word
bindkey "^W" forward-word
bindkey "^B" backward-word
bindkey "^U" backward-kill-line
#export PS1='%1d %# '
export PS1='%~ %# '
export EDITOR=vim
export GIT_EDITOR=$EDITOR
export FORCE_COLOR=1
gdiff() {
if [ $# -ne 2 ]
then
>&2 echo 'usage: gdiff BASE_FILE OTHER_FILE'
return 1
fi
diff -u --color=always $1 $2
}
timer() {
if [ $# -ne 0 ]
then
>&2 echo 'usage: timer'
return 1
fi
local n=0
while [ 1 -eq 1 ]
do
echo $n
local n=$((n + 1))
sleep 1
done
}
todo() {
vim $HOME/.todo
}
git-author-rewrite() {
# usage:
#
# Adapted from https://help.github.com/articles/changing-author-info/
#
# $ git clone --bare https://github.com/user/repo.git
# $ cd repo.git
# $ OLD_EMAIL=... NEW_NAME=... NEW_EMAIL=... git-author-rewrite
# $ # review git log here to verify expectations ...
# $ git push --force --tags origin 'refs/heads/*'
#
vars_msg='must be set: $OLD_EMAIL, $NEW_NAME, $NEW_EMAIL'
if [ -z "$OLD_EMAIL" ]
then
>&2 echo $vars_msg
return 1
elif [ -z "$NEW_NAME" ]
then
>&2 echo $vars_msg
return 1
elif [ -z "$NEW_EMAIL" ]
then
>&2 echo $vars_msg
return 1
fi
git filter-branch --env-filter '
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$NEW_NAME"
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
}
if [ -f ~/.motd ]
then
cat ~/.motd | head -n 1
fi
if [ -f ~/.local.zshrc ]
then
source ~/.local.zshrc
fi