Commit 62a155d9 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Fix various problems in .vim/spell/update.sh

parent 768c5457
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
#!/bin/bash
SPELL_DIR=`dirname $0`
GIT_DIR=`git rev-parse --git-dir`
declare -a FILES
set -eu

if [ -z "${DEBUG}" ]; then
if [ -z "${DEBUG-}" ]; then
	silent_flag=-s
	quit_flag="-c :q"
else
	set -x
fi

unset NVIM_LISTEN_ADDRESS
: ${VIM_BIN:=~/.vim/bin/vim.remote}

SPELL_DIR=`dirname $0`
GIT_DIR=`git rev-parse --git-dir`
declare -a FILES=()

# remove commented-out entries
ex -E ${silent_flag} -c ':runtime spell/cleanadd.vim' ${quit_flag}
sed -i.bac '/^#[^#].*/d' "$SPELL_DIR"/*.add

for file in "$SPELL_DIR"/*.add; do
	mv "${file}" "${file}.tmp"
	sort -f -u "${file}.tmp" > "${file}"
	rm "${file}.tmp"
	ex -E ${silent_flag} -c ':mkspell! %' ${quit_flag} "${file}"
	${VIM_BIN} -E ${silent_flag-} -c ':mkspell! %' ${quit_flag-} "${file}"
	[[ $(basename $file) =~ ^en ]] || FILES+=( "${file}" "${file}.spl" )
done

@@ -29,7 +36,8 @@ elif [ -d "$GIT_DIR"/rebase-merge ]; then
elif [ -e "$GIT_DIR"/MERGE_MSG ]; then
	git commit --include "${FILES[@]}"
else
	git commit --only "${FILES[@]}" -F- <<-END_MESSAGE
	git add "${FILES[@]}"
	git commit -F- <<-END_MESSAGE
		Add vim spell file updates from `hostname` `date +%D`

		Automatically generated: