mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 12:44:24 +08:00
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 <nico.vince@gmail.com>
This commit is contained in:
@@ -30,10 +30,10 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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 "set nomagic" \
|
||||||
-c "${EXCMD}" \
|
-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 ))"
|
START_LINE="$(( CENTER - FZF_PREVIEW_LINES / 2 ))"
|
||||||
if (( START_LINE <= 0 )); then
|
if (( START_LINE <= 0 )); then
|
||||||
|
|||||||
Reference in New Issue
Block a user