-
-
Notifications
You must be signed in to change notification settings - Fork 6
healthcheck
Ronald Record edited this page Sep 1, 2023
·
1 revision
The lazyman
menu includes a "Health Check" entry which can be used to
generate and view a Neovim configuration health check. A menu of installed
Neovim configurations is presented along with the menu entry "All Configs".
A health check is generated for the selected configuration or all installed
Neovim configurations. The health checks are stored in
~/.config/nvim-Lazyman/info/health/
.
The scripts/healthcheck.sh script is used to generate health checks for each selected Neovim configuration.
The scripts/healthcheck.sh
source code:
#!/usr/bin/env bash
#
# healthcheck.sh [config name]
#
# Generate a Neovim configuration health check from the command line
# If no configuraton name is given, use 'nvim-Lazyman'
#
# Generated health checks are stored in ~/.config/nvim-Lazyman/info/health/
CONFDIR="${HOME}/.config"
LMANDIR="${CONFDIR}/nvim-Lazyman"
HEALTHDIR="${LMANDIR}/info/health"
[ -d "${HEALTHDIR}" ] || mkdir -p "${HEALTHDIR}"
checkdir="nvim-Lazyman"
[ "$1" ] && checkdir="$1"
nvimconf=$(echo "${checkdir}" | sed -e "s/^nvim-//")
[ -d "${CONFDIR}/${checkdir}" ] || {
if [ -d "${CONFDIR}/nvim-${checkdir}" ]
then
nvimconf="${checkdir}"
checkdir="nvim-${checkdir}"
else
echo "Cannot locate Neovim configuration directory for $nvimconf"
exit 1
fi
}
HEALTH="${nvimconf}.md"
export NVIM_APPNAME="${checkdir}"
nvim --headless "+checkhealth" "+w!${HEALTHDIR}/${HEALTH}" +qa \
"${LMANDIR}"/README.md "${LMANDIR}"/init.lua >/dev/null 2>&1
[ -f "${HEALTHDIR}/${HEALTH}" ] && {
sed -i "1s;^;# ${checkdir} Neovim health check\n;" "${HEALTHDIR}/${HEALTH}"
}