summaryrefslogtreecommitdiff
path: root/zshrc
blob: 33ebf111c64c563807b54849918fee3b5ef6d187 (plain)
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
# Environment
export DOTFILES_PATH=$HOME/.dotfiles
export KEYTIMEOUT=1
export VISUAL=nvim
export EDITOR=$VISUAL
export TERM=xterm-256color
export COLORTERM=24bit
export VIM_BACKGROUND=dark
export VIM_THEME=gruvbox
export VIM_AIRLINE_THEME=gruvbox

# Custom shell functions
source $DOTFILES_PATH/pairing.zsh
source $DOTFILES_PATH/multi-branch.zsh
source $DOTFILES_PATH/git.zsh
source $DOTFILES_PATH/work.zsh

# Version managers
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
source $HOME/.cargo/env

# Use the latest ruby for shells by default
chruby $(ls ~/.rubies | tail -n 1)


arch="$(arch)"
if [[ $arch =~ "arm64" ]]; then
  export PATH="/opt/homebrew/bin:$PATH"
fi
export PATH="$DOTFILES_PATH/bin:$PATH"
export PATH="$HOME/go/bin:$PATH"
export PATH="$HOME/.lein:$PATH"
export JAVA_HOME="/usr/local/opt/openjdk"

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"

# Auto complete
zmodload zsh/complist
autoload -Uz compinit
compinit

# Prompt style
autoload -U colors zsh/terminfo
colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' check-for-staged-changes true
zstyle ':vcs_info:*' stagedstr '%F{2}*'
zstyle ':vcs_info:*' unstagedstr '%F{1}*'
zstyle ':vcs_info:git*' formats " %F{14}%b%u%c%m%{$reset_color%}"
precmd() { vcs_info }

setprompt() {
  setopt prompt_subst

  PS1=${(j::Q)${(Z:Cn:):-$'
    %F{4}%~%f
    ${vcs_info_msg_0_}
    %F{5}%(1j. %j.)%f
    " "
    %(?.%F{10}.%F{1})λ%f
    " "
  '}}
}
setprompt

bindkey -v
ulimit -Sn 10240

eval "$(direnv hook zsh)"
eval "`fnm env --use-on-cd`"
fnm use 18

export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/openssl@3/lib/
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib/
source $DOTFILES_PATH/commands.zsh