File: init.zsh

package info (click to toggle)
zplug 2.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,068 kB
  • sloc: sh: 1,504; awk: 235; makefile: 26
file content (49 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (4)
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
__zplug::base()
{
    local     load_file arg
    local -aU load_files

    while (( $# > 0 ))
    do
        arg="$1"
        case "$arg" in
            -*|--*)
                return 1
                ;;
            */'*')
                # e.g. 'base/*'
                load_files+=( "$ZPLUG_ROOT/base/${arg:h}"/*.zsh(N-.) )
                ;;
            */*)
                # e.g. 'core/add'
                load_files+=( "$ZPLUG_ROOT/base/${arg}.zsh"(N-.) )
                ;;
            *)
                return 1
                ;;
        esac
        shift
    done

    # invalid format
    if (( $#load_files == 0 )); then
        return 1
    fi

    fpath=(
    "${load_files[@]:h}"
    "${fpath[@]}"
    )

    for load_file in "${load_files[@]}"
    do
        if (( $+functions[$load_file] )); then
            # already defined
            continue
        fi

        autoload -Uz "${load_file:t}" &&
            eval "${load_file:t}"     &&
            unfunction "${load_file:t}"
    done
}