-
Notifications
You must be signed in to change notification settings - Fork 2
/
.zshrc
107 lines (85 loc) · 2.39 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
#
# Prompt
#
export PROMPT="→ "
function precmd()
{
# Hostname
host_name="%F{cyan}"$(scutil --get LocalHostName)":%f"
# Working directory
working_dir=" %F{yellow}${PWD/$HOME/~}%f"
# Elasped time since last command
if [ $timer ]; then
elapsed_time=" %F{cyan}+${$(($SECONDS - $timer))}s%f"
timer=""
else
elapsed_time=""
fi
# Git status
if git rev-parse --git-dir > /dev/null 2>&1; then
git_color=$([[ $(git status --porcelain | tail -n1) == "" ]] && echo "%F{green}" || echo "%F{red}")
git_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
if [[ $git_branch == "" ]]; then
git_branch="no-branch"
fi
git_status=" $git_color"[git:"$git_branch"]"%f"
else
git_status=""
fi
# Final prompt
print -rP "$host_name$working_dir$git_status$elapsed_time"
}
function preexec()
{
timer=$SECONDS
}
#
# Misc settings
#
setopt auto_cd
#
# History settings
#
# File configuration
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
# History search with up/down keys
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward
setopt HIST_EXPIRE_DUPS_FIRST # Drop duplicates first when trimming the history
setopt HIST_IGNORE_DUPS # Do not save immediate duplicate commands
setopt HIST_IGNORE_SPACE # Do not save commands starting with a space
setopt INC_APPEND_HISTORY # Do not wait for a command to complete to save
setopt SHARE_HISTORY # Share history between sessions
#
# Environment vars
#
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin"
export PATH="/usr/local/sbin:$PATH"
export PATH="/Users/johan/.depot_tools:$PATH"
export PATH="/Users/johan/.android_platform_tools:$PATH"
export PATH="/Applications/Hugin/HuginTools:$PATH"
export PATH="/usr/local/share/python:$PATH"
export PATH="/usr/local/go/bin:$PATH"
#
# Git settings
#
export GIT_EDITOR=nano
#
# Aliases
#
alias nwjs="/Applications/nwjs.app/Contents/MacOS/nwjs"
alias handbrake="/Applications/HandbrakeCLI"
alias st="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
alias stree="/Applications/SourceTree.app/Contents/Resources/stree"
alias atom="/Applications/Atom.app/Contents/Resources/app/atom.sh"
#
# Language (for tools like GPG...)
#
export LANG="en"
#
# johansatge/data-hoarding
#
export DATA_HOARDING_PATH="/Volumes/AirData/Dev/Github/data-hoarding"
. ${DATA_HOARDING_PATH}/aliases.sh