3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh
Matthieu Coudron 9663a29afa buildVimPlugin: add vimCommandCheckHook
Modeled after pythonImportCheckHook, this checks a command can be run once the plugin is installed
2022-04-30 23:54:25 +02:00

26 lines
639 B
Bash

# Setup hook for checking whether a vim command exists
echo "Sourcing vim-command-check-hook.sh"
vimCommandCheckHook () {
echo "Executing vimCommandCheckHook"
if [ -n "$vimCommandCheck" ]; then
echo "Check whether the following modules can be imported: $vimCommandCheck"
# editorconfig-checker-disable
export HOME="$TMPDIR"
@vimBinary@ -es -n -u NONE -i NONE --clean -V1 --cmd "set rtp+=$out" \
--cmd "runtime! plugin/*.vim" <<-EOF
if exists(":$vimCommandCheck") == 2
cquit 0
else
cquit 1
fi
EOF
fi
}
echo "Using vimCommandCheckHook"
preDistPhases+=" vimCommandCheckHook"