diff --git a/bin/tagpreview.sh b/bin/tagpreview.sh index 07ca0da..852515b 100755 --- a/bin/tagpreview.sh +++ b/bin/tagpreview.sh @@ -38,8 +38,15 @@ fi export FZFVIM_EXCMD="${EXCMD}" # WSL shares only the variables named in WSLENV with a Windows vim.exe export WSLENV="FZFVIM_EXCMD/w${WSLENV:+:${WSLENV}}" +# Ex mode starts on the last line, so an address that did not reach Vim would +# center the preview there rather than say anything. Show nothing instead +REQUIRE_EXCMD="" +if [ -n "${EXCMD}" ]; then + REQUIRE_EXCMD='if empty($FZFVIM_EXCMD) | cquit | endif' +fi CENTER="$("${VIMNAME}" -R -i NONE -u NONE -e -m -s "${FILE}" \ -c "set nomagic" \ + -c "${REQUIRE_EXCMD}" \ -c 'silent sandbox execute $FZFVIM_EXCMD' \ -c 'let l=line(".") | new | put =l | print | qa!')" || exit