mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-09-30 07:32:23 +08:00
Show no preview when the address does not reach Vim
Ex mode starts on the last line, so an empty $FZFVIM_EXCMD centered the preview at the end of the file and said nothing. Quit with an error instead, which the existing '|| exit' turns into a blank preview.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user