]> git.rmz.io Git - dotfiles.git/blob - zshrc
zsh: configure PATH before loading config files
[dotfiles.git] / zshrc
1 # Path to config files
2 ZSH=$XDG_CONFIG_HOME/zsh
3 ZSH_DATA=$XDG_DATA_HOME/zsh
4 ZSH_CACHE=$XDG_CACHE_HOME/zsh
5 [[ ! -d "$ZSH" ]] && echo "Missing config dir: '$ZSH'" && return
6 [[ ! -d "$ZSH_CACHE" ]] && echo "Missing cache dir: '$ZSH_CACHE'" && return
7 [[ ! -d "$ZSH_DATA" ]] && echo "Missing data dir: '$ZSH_DATA'" && return
8
9 # populate path (order matters)
10 typeset -U path # make path a unique array
11 # osx gnu utils (installed via brew)
12 [[ -d /usr/local/opt/coreutils/libexec/gnubin ]] && path=(/usr/local/opt/coreutils/libexec/gnubin $path)
13 [[ -d /usr/local/opt/findutils/libexec/gnubin ]] && path=(/usr/local/opt/findutils/libexec/gnubin $path)
14 [[ -d /usr/local/opt/gnu-sed/libexec/gnubin ]] && path=(/usr/local/opt/gnu-sed/libexec/gnubin $path)
15 # osx pip 3.7 install
16 [[ -d ~/Library/Python/3.7/bin ]] && path=(~/Library/Python/3.7/bin $path)
17 # personal scripts
18 [[ -d ~/.local/bin ]] && path=(~/.local/bin $path)
19 [[ -d ~/bin ]] && path=(~/bin $path)
20 # android
21 [[ -d /opt/android-sdk ]] && path=($path /opt/android-sdk/platform-tools)
22
23 # load my functions
24 typeset -U fpath # make fpath a unique array
25 [[ -d $ZSH/functions ]] && fpath=($ZSH/functions $fpath)
26 autoload -U ${fpath[1]}/*(:t) # loads all functions in the first element of fpath
27
28 # Load all of the config files in $ZSH/lib that end in .zsh
29 for config_file ($ZSH/lib/*.zsh); do
30 source $config_file
31 done
32
33 # Set name of the theme to load.
34 # Look in $ZSH/themes
35 ZSH_THEME="ramsi"
36 [[ -f "$ZSH/themes/${ZSH_THEME}.zsh-theme" ]] && source "$ZSH/themes/${ZSH_THEME}.zsh-theme"
37
38 # initialise completion
39 autoload -U compinit; compinit -d "$ZSH_CACHE/zcompdump"
40
41 # miscelaneous options
42 setopt extendedglob
43 setopt nonomatch # if glob does not match, pass it to the command
44 setopt numeric_glob_sort # sort numerically not lexically
45 setopt noclobber # don't allow overwriting files with '>', use '>!' instead
46 setopt notify
47 setopt rcquotes # echo 'don''t'; prints don't
48 setopt dvorak # correct_all uses dvorak
49 setopt rematch_pcre # use perl regexp
50
51 # disable flow control
52 setopt noflowcontrol
53 stty -ixon
54
55 # source aliases
56 [[ -f $XDG_CONFIG_HOME/aliases ]] && source $XDG_CONFIG_HOME/aliases
57 for alias_file ($ZSH/aliases/*.zsh); do
58 source $alias_file
59 done
60
61 # set up a few named directories
62 hash -d fook=/mnt/fook
63 hash -d src=~/src
64
65 # wio named dirs
66 hash -d wio=~/src/wio