2023-10-09 09:32:49 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# In case we are on SteamOS?
|
2024-06-09 10:51:02 +02:00
|
|
|
set -x
|
2023-10-09 09:32:49 +02:00
|
|
|
# The usual system-wide installation
|
|
|
|
if [ -f /usr/bin/nvim ]; then
|
2024-03-20 05:50:18 +01:00
|
|
|
/usr/bin/nvim "$@"
|
2023-10-09 09:32:49 +02:00
|
|
|
# System-wide flatpak
|
|
|
|
elif [ -f /var/lib/flatpak/exports/bin/io.neovim.nvim ]; then
|
2024-03-20 05:50:18 +01:00
|
|
|
flatpak run io.neovim.nvim "$@"
|
2023-10-09 09:32:49 +02:00
|
|
|
# User-specific flatpak
|
|
|
|
elif [ -f ~/.local/share/flatpak/exports/bin/io.neovim.nvim ]; then
|
2024-03-20 05:50:18 +01:00
|
|
|
flatpak run --user io.neovim.nvim "$@"
|
2024-06-09 10:51:02 +02:00
|
|
|
# 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 "$@"
|
2023-10-09 09:32:49 +02:00
|
|
|
# If not found.
|
|
|
|
else
|
2024-06-09 10:51:02 +02:00
|
|
|
printf "Neither nvim or vim found :("
|
2024-06-07 07:56:46 +02:00
|
|
|
exit
|
2023-10-09 09:32:49 +02:00
|
|
|
fi
|
|
|
|
#set +x
|