From e0d131d95364edf940a70127fcb5748b86e6955e Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 17 Jul 2023 11:57:01 +0200 Subject: [PATCH] tagpreview: open vim in readonly mode, and exit on failure (#1488) - When computing the center line, 'exit' on failure instead of 'return'. - Open vim in read-only mode to avoid a non-zero exit code if the file is already opened. Signed-off-by: Nicolas VINCENT --- bin/tagpreview.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/tagpreview.sh b/bin/tagpreview.sh index e07f87d..e00bc2c 100755 --- a/bin/tagpreview.sh +++ b/bin/tagpreview.sh @@ -30,10 +30,10 @@ else exit 1 fi -CENTER="$("${VIMNAME}" -i NONE -u NONE -e -m -s "${FILE}" \ +CENTER="$("${VIMNAME}" -R -i NONE -u NONE -e -m -s "${FILE}" \ -c "set nomagic" \ -c "${EXCMD}" \ - -c 'let l=line(".") | new | put =l | print | qa!')" || return + -c 'let l=line(".") | new | put =l | print | qa!')" || exit START_LINE="$(( CENTER - FZF_PREVIEW_LINES / 2 ))" if (( START_LINE <= 0 )); then