mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 20:54:28 +08:00
Use nvim if vim not installed (#1262)
The `tagpreview.sh` script is hardcoded to the `vim` binary. For users that only have Neovim installed an error is displayed and no preview is rendered. This change addresses this by falling back to the `nvim` binary if the `vim` binary isn't present.
This commit is contained in:
@@ -20,7 +20,17 @@ if [ ! -r "$FILE" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CENTER="$(vim -i NONE -u NONE -e -m -s "${FILE}" \
|
# If users aren't using vim, they are probably using neovim
|
||||||
|
if command -v vim > /dev/null; then
|
||||||
|
VIMNAME="vim"
|
||||||
|
elif command -v nvim > /dev/null; then
|
||||||
|
VIMNAME="nvim"
|
||||||
|
else
|
||||||
|
echo "Cannot preview tag: vim or nvim unavailable"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CENTER="$("${VIMNAME}" -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!')" || return
|
||||||
|
|||||||
Reference in New Issue
Block a user