scripts/bash/usr-local-bin/nvim

32 lines
915 B
Bash
Executable File

#!/usr/bin/env bash
# In case we are on SteamOS?
set -x
# The usual system-wide installation
if [ -f /usr/bin/nvim ]; then
/usr/bin/nvim "$@"
# System-wide flatpak
elif [ -f /var/lib/flatpak/exports/bin/io.neovim.nvim ]; then
flatpak run io.neovim.nvim "$@"
# User-specific flatpak
elif [ -f ~/.local/share/flatpak/exports/bin/io.neovim.nvim ]; then
flatpak run --user io.neovim.nvim "$@"
# Snap
elif [ -f /snap/bin/nvim ]; then
snap run nvim "$@"
# Fallback to vim, because this script breaks my alias/function
elif [ -f /usr/bin/vim ]; then
/usr/bin/vim "$@"
elif [ -f /var/lib/flatpak/exports/bin/org.vim.Vim ]; then
flatpak run org.vim.Vim "$@"
elif [ -f ~/.local/share/flatpak/exports/bin/org.vim.Vim ]; then
flatpak run --user org.vim.Vim "$@"
# Fallback to Vi is acceptable.
elif [ -f /usr/bin/vi ]; then
/usr/bin/vi "$@"
# If not found.
else
printf "Neither nvim or vim found :("
exit
fi
#set +x