-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc.local
50 lines (44 loc) · 1.11 KB
/
zshrc.local
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
# The current branch name
# Usage example: git pull origin $(current_branch)
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
# it's not a symbolic ref, but in a Git repo.
function current_branch() {
local ref
ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]; then
[[ $ret == 128 ]] && return # no git repo.
ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
}
todo() {
todo_file=~/.todo_file.txt
if test ! -f "$todo_file"
then
touch "$todo_file"
fi
case "$1" in
"list")
cat "$todo_file"
;;
"add")
echo "$2" >> "$todo_file"
;;
"complete")
to_write=$(grep -v "$2" "$todo_file")
echo "$to_write" > "$todo_file"
;;
"edit")
vim "$todo_file"
;;
*)
;;
esac
}
# work aliases
[[ -f ~/.zshrc.work ]] && source ~/.zshrc.work
# Local work config
[[ -f ~/.aliases.work ]] && source ~/.aliases.work
# if you wish to use IMDS set AWS_EC2_METADATA_DISABLED=false
export AWS_EC2_METADATA_DISABLED=true