#!/bin/bash

echo Downloading Neovim

wget -O /tmp/nvim.appimage \
  https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage

# The last command was ok?
if [ $? -eq 0 ]; then
  echo Neovim downloaded
  echo Moving temporal file
  chmod +x /tmp/nvim.appimage
  mv /tmp/nvim.appimage ~/bin/
  ln -s -f ~/bin/nvim.appimage ~/bin/nvim
  echo "Neovim updated!"
  nvim --version | head -n 1
else
  echo "Something bad happened while downloading Neovim :("
fi
