summaryrefslogtreecommitdiff
path: root/zshrc
blob: 1fbe57b45c7e333e090fa690c41c8a52285d0b94 (plain) (blame)
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
print -Pv zrc %N  # get current file location, store it in $zrc
zrc=$zrc:A      # resolve $zrc (assume path) to its absolute location
zshd=${zrc:h}

: ${zd:=$HOME/.zsh}

# spath -> autosource path, ala plugins
# apath -> sourceall path, for .d dirs
typeset -T SPATH spath
typeset -T APATH apath

# default values
spath=(
    $zd/plugins
    $zshd/plugins
)
apath=(
    $zshd/source
    $zd/source
)

# user stuff comes first
# completions come after the functions they complete
fpath+=(
    $zd/functions
    $zd/completions
    $zd/prompts
    $zshd/functions
    $zshd/completions
    $zshd/prompts
)
# you can use your functions as standalone scripts without autoloading them
# just +x
path+=(
    $zd/functions
)

# sourced before sourcealling
# should be the location to edit fpath/apath/spath
[[ -f $zd/pre ]] && . $zd/pre

# allow digest drop-in
if [[ -d $zd/digests ]]; then
    local f=
    for f in $zd/digests/*.zwc(N); do
        fpath+=( $f )
        autoload -w $f
    done
fi

autoload sourceall
sourceall zsh # source every .zsh file in every $apath[@] directory

# local zshrc
[[ -f $zd/zshrc.local ]] && . $zd/zshrc.local

# LITERALLY THE VERY LAST THING WE DO IS COMPINIT PLS DUN DO IT URSELF
autoload -Uz compinit
compinit

# vim: ft=zsh