]> git.r.bdr.sh - rbdr/dotfiles/blob - runcoms/zshrc
Improve macos config
[rbdr/dotfiles] / runcoms / zshrc
1 ################################################################################
2 # Load Functions
3 ################################################################################
4 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/git-info.zsh"
5 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/dotenv.zsh"
6 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/graphviz.zsh"
7 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/short-uptime.zsh"
8 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/figlet-sample.zsh"
9 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/prettify-json.zsh"
10
11 ################################################################################
12 # Load Modules
13 ################################################################################
14 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/environment.zsh"
15 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/editor.zsh"
16 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/history.zsh"
17 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/directory.zsh"
18 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/prompt.zsh"
19 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/vendor/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
20 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/completion.zsh"
21 source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/modules/aliases.zsh"
22
23 ################################################################################
24 # ENV VARIABLES
25 ################################################################################
26 # Terminal related
27 export TERM=xterm-256color-italic
28
29 # Paths
30 # export JAVA_HOME=$(/usr/libexec/java_home) # Enable if using JDK, otherwise disable for performance
31 export GOPATH=$HOME/Projects/go
32 export ANDROID_HOME=$HOME/Library/Android/sdk
33 export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk-bundle
34 export NVM_DIR=$HOME/.nvm
35 export PATH=$PATH:$HOME:${GOPATH//://bin:}/bin
36 export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME:/Applications/calibre.app/Contents/MacOS
37
38 # Editor.
39 export EDITOR="nvim"
40 export VISUAL="nvim"
41
42 # Python related variables
43 export VIRTUAL_ENV_DISABLE_PROMPT=1
44 export WORKON_HOME=$HOME/.virtualenvs
45 export PROJECT_HOME=$HOME/Documents/projects
46
47 # GPG
48 export GPG_TTY=$(tty)
49
50 # FZF Config
51 [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
52 [ -f /usr/share/doc/fzf/examples/key-bindings.zsh ] && source /usr/share/doc/fzf/examples/key-bindings.zsh
53 [ -f /usr/share/doc/fzf/examples/completion.zsh ] && source /usr/share/doc/fzf/examples/completion.zsh
54
55 export FZF_DEFAULT_COMMAND='/usr/bin/env rg --color never --files --hidden -g \!.git'
56 export FZF_DEFAULT_OPTS='--preview ''bat --style=numbers --color=always {} | head -500'''
57 if [[ -s "/opt/homebrew/bin/brew" ]]; then
58 export FZF_VIM_PATH=/opt/homebrew/opt/fzf
59 else
60 if [[ -s "/usr/local/bin/brew" ]]; then
61 export FZF_VIM_PATH=/usr/local/opt/fzf
62 else
63 export FZF_VIM_PATH=/usr/share/doc/fzf/examples
64 fi
65 fi
66
67 ################################################################################
68 # SECRET ENV VARS!!
69 ################################################################################
70
71 if [[ -s "${ZDOTDIR:-$HOME}/.secrets.zsh" ]]; then
72 source "${ZDOTDIR:-$HOME}/.secrets.zsh"
73 fi
74
75 # Load a local config
76
77 if [[ -s "${ZDOTDIR:-$HOME}/.zshrc.local" ]]; then
78 source "${ZDOTDIR:-$HOME}/.zshrc.local"
79 fi
80
81 if [[ -s "/opt/homebrew/bin/brew" ]]; then
82 export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH
83 fi
84
85 # Z
86 if [[ -s "/opt/homebrew/bin/brew" ]]; then
87 . /opt/homebrew/etc/profile.d/z.sh
88 else
89 if [[ -s "/usr/share/z/z.sh" ]]; then
90 . /usr/share/z/z.sh
91 else
92 . /usr/local/etc/profile.d/z.sh
93 fi
94 fi
95
96 # ASDF
97 if ! command -v brew &> /dev/null; then
98 if [[ -s "/opt/asdf-vm/asdf.sh" ]]; then
99 . /opt/asdf-vm/asdf.sh
100 else
101 . $HOME/.asdf/asdf.sh
102 fi
103 else
104 . $(brew --prefix asdf)/libexec/asdf.sh
105 fi
106
107 if [[ -s "~/.asdf/plugins/java/set-java-home.zsh" ]]; then
108 . ~/.asdf/plugins/java/set-java-home.zsh
109 fi