aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vim_plugins.sh
blob: 3801b749aad96cbe870747b12c056dfed0bfc076 (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
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail
shopt -s inherit_errexit 2> /dev/null || true
shopt -s lastpipe

plugins_dir="$HOME/.vim/pack/plugins/start"
readonly plugins_dir

plugins=(
    altercation/vim-colors-solarized
    editorconfig/editorconfig-vim
)

pull() {
    local plugin
    for plugin in ${plugins[@]+"${plugins[@]}"}; do
        local name
        name="${plugin#*/}"

        if [ -d "$name" ]; then
            echo "Updating plugin: $plugin"
            git -C "$name" pull
        else
            echo "Installing plugin: $plugin"
            git clone -q "https://github.com/$plugin.git"
        fi
    done
}

main() {
    mkdir -p -- "$plugins_dir"
    cd -- "$plugins_dir"
    pull
}

main