Skip to main content

How to Install or Upgrade neovim, the easy way

 The easiest way to get neovim on ubuntu or wsl ubuntu, is to simply run sudo apt install neovim , however, later on you will want to update it, and you will try to uninstall and run sudo apt update and then install neovim again. All of that to realize that the version remains the same.

I found that the second easiest way of installing and upgrading neovim is to install it form ‘Download’. This will allow you to install the exact version of neovim that you want, and even better, to keep multiple versions of neovim at the same time. Beyond that you can code a script to automatically switch between versions.

This is how I reinstalled neovim without loosing any configuration. I used this article as a reference: https://docs.rockylinux.org/books/nvchad/install_nvim/.

  1. Backup your config files: I would recommend you to create a Github repository of your neovim configuration files, just in case.
  2. Check your current nvim bin file: The location might change depending on how you installed neovim. In my case I first installed it using sudo apt install. Therefore my nvim folder with all the source code was on /usr/share/ and my bin file or the actual command was on /usr/bin/. I’m using WSL, so I’m not sure if an actual linux environment will be the same. You can use which nvim to figure out where the bin file is located.
  3. Remove neovim: I removed my current version of neovim with this command: sudo apt remove neovim -y. Since this is the most common way of installing in Ubuntu, I’m can’t provide how to uninstall with different package managers.
  4. Download the version of neovim that you want: You will need to get the nvim-linux64.tar.gz and the nvim-linux64.tar.gz.sha256sum files from this link: https://github.com/neovim/neovim/releases. You can download them anywhere you want, if you are using WSL make sure to have them in the linux directory not windows, just to make it easier to find. Try to choose a root folder or create a new folder with only those 2 files, since you’re gonna delete them later on.
  5. Verify the sha256 file: Run this command to verify the file: sha256sum -c nvim-linux64.tar.gz.sha256sum .You should get something like this: nvim-linux64.tar.gz: OK . Remember that both files should be in the same directory.
  6. Unpack the compressed file to the old directory where neovim sourcecode was installed: Going back to step 2, we can use this command (using your own directory): sudo tar xvzf nvim-linux64.tar.gz -C /usr/share/. In this step you can actually unpack it anywhere you want, but the directory share is a common one, another similar to this is: ~/.local/share , so feel free to organize it how you like.
  7. Create a symbolic link to the bin file or command: Know we only have to sort of create a shortcut for the executable or command file. Since our configuration is already calling the command nvim from the directory in Step 1. We are just going to add a link to the new command. Move to the directory you got in Step 1 and run sudo ln -sf /usr/share/nvim-linux64/bin/nvim nvim to create the link.

Now open a new terminal or source the config file and run nvim -v to see the version that you just installed. If you get an error like “nvim command not found”, try going back to Step 1 or installing neovim the old way sudo apt install neovim to find out where the command was being called from before uninstalling.

Note: Some cache and swap files will be deleted, so you probably won’t be able to see your old neovim commands in the history. Also if you have installed startify, you might get an error, but it should be because you haven’t opened any file yet.

Comments

Popular posts from this blog

How to start programming

 When you're starting in your process to become a Software Developer, either on your own or at a college, you'll need no understand the programming logic and how to solve different problems before learning a programming language. That's why I provide this tips and steps in order to understand programming. First of all, you need to know basic concepts of computer science, such as how a computer works, parts of a computer, and some logic problems. To involve in computers world you can research about the afore mentioned topics. I recommend you to watch videos, read short posts and also trying to teach someone what you just read. The second step I followed to involve in problem solving is creating flowcharts . I used to transform a bunch of exercises into flowcharts, and it helped me to understand how the programming logic works and to see many ways to solve the same problem. Though you need to learn some figures and know when and how to use them in order to create a correct ch...

Loops in programming

 If we are starting in the programming world, we've ever came across with a problem that has repetitive code or, also when we're working with array and many other similar situations. In this blog, I'm going to explain what a loop is, its types and some examples. First, a loop is something that is repeating many times until we decided when it to stop. Taking an example from real life, it could be your daily commute, you go to your work or school every day in the same way. Now, applying it to programming, a loop can execute a specific block code the times we want. The perfect example is a counter, but we'll see this example further in the blog. Second of all, let's see some kinds of loops and which ones are the most common in real programming. In my opinion, the most used loop is for or foreach.  It is perfect to iterate over all the items in an array, since arrays are very common when getting information from databases such as users, products, etc. It also needs a st...