diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-04 09:47:40 +0100 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-04 09:47:40 +0100 |
commit | 9107900d644e6241eaf0e383d61ba05adff87ebf (patch) | |
tree | cb689fcd8bd942c4fe26c6b5e1f551276738542d | |
parent | vim: add an empty line (diff) | |
download | linux-home-9107900d644e6241eaf0e383d61ba05adff87ebf.tar.gz linux-home-9107900d644e6241eaf0e383d61ba05adff87ebf.zip |
vim_solarized.sh: refactoring
-rwxr-xr-x | vim_solarized.sh | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/vim_solarized.sh b/vim_solarized.sh index fc5f20d..bb7ae77 100755 --- a/vim_solarized.sh +++ b/vim_solarized.sh @@ -4,14 +4,32 @@ set -o errexit -o nounset -o pipefail shopt -s inherit_errexit lastpipe plugins_dir="$HOME/.vim/pack/plugins/start" -name='vim-colors-solarized' +readonly plugins_dir -mkdir -p -- "$plugins_dir" -cd -- "$plugins_dir" +plugins=( + alteraction/vim-colors-solarized +) -if [ -d "$name" ]; then - cd -- "$name" - git pull -else - git clone "https://github.com/altercation/$name.git" -fi +pull() { + local plugin + for plugin in ${plugins[@]+"${plugins[@]}"}; do + echo "Plugin: $plugin" + + local name + name="${plugin#*/}" + + if [ -d "$name" ]; then + git -C "$name" pull + else + git clone "https://github.com/$plugin.git" + fi + done +} + +main() { + mkdir -p -- "$plugins_dir" + cd -- "$plugins_dir" + pull +} + +main |