]> git.rmz.io Git - dotfiles.git/blob - zshrc
vim: import some options from nvim LazyVim
[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 # load my functions
10 typeset -U fpath # make fpath a unique array
11 [[ -d $ZSH/functions ]] && fpath=($ZSH/functions $fpath)
12 autoload -U ${fpath[1]}/*(:t) # loads all functions in the first element of fpath
13
14 # Load all of the config files in $ZSH/lib that end in .zsh
15 for config_file ($ZSH/lib/*.zsh); do
16 source $config_file
17 done
18
19 # Set name of the theme to load.
20 # Look in $ZSH/themes
21 ZSH_THEME="ramsi"
22 [[ -f "$ZSH/themes/${ZSH_THEME}.zsh-theme" ]] && source "$ZSH/themes/${ZSH_THEME}.zsh-theme"
23
24 # initialise completion
25 autoload -U compinit; compinit -d "$ZSH_CACHE/zcompdump"
26
27 # miscelaneous options
28 setopt extendedglob
29 setopt nonomatch # if glob does not match, pass it to the command
30 setopt numeric_glob_sort # sort numerically not lexically
31 setopt noclobber # don't allow overwriting files with '>', use '>!' instead
32 setopt notify
33 setopt rcquotes # echo 'don''t'; prints don't
34 setopt dvorak # correct_all uses dvorak
35 setopt rematch_pcre # use perl regexp
36
37 # disable flow control
38 setopt noflowcontrol
39 stty -ixon
40
41 # populate path (order matters)
42 typeset -U path # make path a unique array
43 # osx gnu utils (installed via brew)
44 [[ -d /usr/local/opt/coreutils/libexec/gnubin ]] && path=(/usr/local/opt/coreutils/libexec/gnubin $path)
45 [[ -d /usr/local/opt/findutils/libexec/gnubin ]] && path=(/usr/local/opt/findutils/libexec/gnubin $path)
46 [[ -d /usr/local/opt/gnu-sed/libexec/gnubin ]] && path=(/usr/local/opt/gnu-sed/libexec/gnubin $path)
47 # osx pip 3.7 install
48 [[ -d ~/Library/Python/3.7/bin ]] && path=(~/Library/Python/3.7/bin $path)
49 # personal scripts
50 [[ -d ~/.local/bin ]] && path=(~/.local/bin $path)
51 [[ -d ~/bin ]] && path=(~/bin $path)
52 # android
53 [[ -d /opt/android-sdk ]] && path=($path /opt/android-sdk/platform-tools)
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