-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
95 lines (83 loc) · 2.16 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
# Platform detection: https://stackoverflow.com/a/8597411
# oh-my-zsh config
export ZSH_DISABLE_COMPFIX=true
export ZSH=$HOME/.oh-my-zsh
DISABLE_UPDATE_PROMPT=true
ZSH_THEME="dga"
plugins=(zsh-autosuggestions zsh-syntax-highlighting git rust)
if [[ "$OSTYPE" == "darwin"* ]]; then
plugins+=(brew macos)
fi
source $ZSH/oh-my-zsh.sh
# Cargo (Rust package manager)
if [[ -f "$HOME/.cargo/env" ]]; then
source $HOME/.cargo/env
fi
# Editor
export EDITOR=vim
export VISUAL=$EDITOR
# Dir colours
if hash dircolors 2>/dev/null; then
if ls --color -d . >/dev/null 2>&1; then
eval `dircolors $HOME/.dotfiles/dir_colors`
fi
fi
# Native symlinks on Windows
if [[ "$(uname -s)" =~ MSYS ]]; then
export MSYS=winsymlinks:nativestrict
fi
# Go
# The GOPATH is set to where we want global go libraries to be installed. Projects should append
# their src path to the GOPATH
export GOPATH="$HOME/.go"
export PATH="$GOPATH/bin:$PATH"
# Enable Virtualenv Wrapper
export WORKON_HOME="$HOME/.virtualenvs"
export PROJECT_HOME=$PROJECTS_HOME
if [ -f /usr/bin/virtualenvwrapper.sh ]; then
source /usr/bin/virtualenvwrapper.sh
elif [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
source /usr/local/bin/virtualenvwrapper.sh
elif [ -f $HOME/.local/bin/virtualenvwrapper.sh ]; then
source $HOME/.local/bin/virtualenvwrapper.sh
fi
# direnv
if hash direnv 2>/dev/null; then
eval "$(direnv hook zsh)"
fi
# Aliases
alias pd="pushd"
if [[ "$(uname -s)" =~ MSYS ]]; then
alias ls="ls -I NTUSER.DAT\* -I ntuser.dat\* -I ntuser.ini"
fi
alias la="ls -lhA"
alias ll="ls -lh"
alias gl="git log --graph --all"
alias gb="git branch --all"
alias grep="grep --color=auto"
if [[ "$(uname -s)" =~ MSYS ]]; then
alias open="start"
fi
if hash xdg-open 2>/dev/null; then
alias open="xdg-open"
fi
if hash yay 2>/dev/null; then
alias pacman="yay"
fi
# Functions
function mkcd {
dir="$*"
mkdir -p "$dir" && cd "$dir"
}
function aur_install {
pushd /tmp
curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz &&
tar xf $1.tar.gz &&
cd $1 &&
makepkg -sri
popd
}
# zsh local config
if [[ -f $HOME/.zshrc.local ]]; then
source $HOME/.zshrc.local
fi