Skip to content

Instantly share code, notes, and snippets.

@opchaves
Created February 20, 2021 14:15
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opchaves/5ba865c9e6415c2af825bad153f876f7 to your computer and use it in GitHub Desktop.
Save opchaves/5ba865c9e6415c2af825bad153f876f7 to your computer and use it in GitHub Desktop.
How to install the latest release of NeoVim in your Ubuntu system (it also works if you're using WSL 2)

Remove neovim if you have it in your system

sudo apt remove --purge neovim
sudo apt autoremove

Download nvim.appimage

cd ~
wget https://github.com/neovim/neovim/releases/download/v0.4.4/nvim.appimage

Move the file and flag it as runnable

sudo mv nvim.appimage /usr/local/bin
sudo chmod +x /usr/local/bin/nvim.appimage

Set the command vi, vim and ex to run neovim

CUSTOM_NVIM_PATH=/usr/local/bin/nvim.appimage
sudo update-alternatives --install /usr/bin/ex v "${CUSTOM_NVIM_PATH}" 110
sudo update-alternatives --install /usr/bin/vi vi "${CUSTOM_NVIM_PATH}" 110
sudo update-alternatives --install /usr/bin/vim vim "${CUSTOM_NVIM_PATH}" 110

Enable neovim clipboard (WSL Only)

Download win32yank.exe within Windows. Choose any path you want. I use C:\Users<user>\win32yank.exe

Run this command:

# Copy/Paste/Cut
# WSL support: https://github.com/neovim/neovim/wiki/FAQ#how-to-use-the-windows-clipboard-from-wsl
# Actually neovim looks for win32yank.exe executable for handling clipboard so we only need symlink that so that it can be accessed on linux
# see: https://github.com/neovim/neovim/blob/master/runtime/autoload/provider/clipboard.vim#L115

sudo ln -s "/mnt/c/path/to/win32yank.exe" "/usr/local/bin/win32yank.exe"
@Rimann91
Copy link

what is ${CUSTOME _NVIM_PATH}? the path to the appimage? or to my .config/nvim?

@isobarbaric
Copy link

I keep getting nvim not found as an error :(

@cdefkc
Copy link

cdefkc commented May 19, 2022

what

@laniusone
Copy link

laniusone commented Jun 11, 2022

Nice one. You could also add 'view' alternative as it is, I believe, set by regular vim package by default too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment