about summary refs log tree commit diff stats
path: root/pkgs/by-name/vi/vim-plugins/update.sh
blob: 6a0d3452fe06fee23f811cfb883d5b1e11933cf4 (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
#!/usr/bin/env sh

BASE_DIR="$(readlink -f "$(dirname "$0")/plugins")"

# Fetch plugins
cd "$BASE_DIR" || (echo "BUG: No '$BASE_DIR'" && exit 1)

# Cleanup manifest
sort -o "$BASE_DIR/manifest.txt" "$BASE_DIR/manifest.txt"
sort -o "$BASE_DIR/blacklist.txt" "$BASE_DIR/blacklist.txt"
## Remove all plugins, which are on the blacklist
# The same file is read and written to
# shellcheck disable=SC2005
echo "$(comm -23 "$BASE_DIR/manifest.txt" "$BASE_DIR/blacklist.txt")" >"$BASE_DIR/manifest.txt"

# Backup vim-plugins.nix
mv "$BASE_DIR/default.nix" "$BASE_DIR/default.nix.bak"
echo "{...} : {}" >"$BASE_DIR/default.nix"

# Generate derivations for new plugins (this binary is provided by the dev-environment)
update-vim-plugins cleanup "$BASE_DIR"

# Restore vim-plugins.nix
mv "$BASE_DIR/default.nix.bak" "$BASE_DIR/default.nix"

# Update new plugins
update-vim-plugins update "$BASE_DIR" --all