How to Install Vim in Ubuntu? [5 Methods]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

To install Vim in Ubuntu, execute the code, sudo apt install vim on your Ubuntu terminal.

Vim is a text-processing editor used in Unix-like operating systems like Linux. Go through this article to learn 5 ways to install Vim in Ubuntu. Moreover, you will also get to learn how to install different versions of Vim and how to uninstall it.

5 Methods to Install Vim in Ubuntu

Vim is readily available on all Linux platforms, therefore installing it doesn’t involve many complicated processes. Since Ubuntu is a Debian-based Linux distro, you can install it using apt, apt-get, and snap package managers. This task can also be accomplished using the graphical user interface (GUI). I will go into great depth about each method in this section.

1. Using “apt”

To install Vim in Ubuntu using the apt package manager, follow the steps below:

  1. Open a terminal window by Pressing CTRL+ALT+T.
  2. Update the repository list before installing Vim using the following command:
    sudo apt update

    updating package list

  3. After updating the packages, install Vim with this command:
    sudo apt install vim

    install vim using apt

  4. To check whether the Vim is installed or not, copy the following code:
    vim --version

    checking vim version

You can also execute this command to check the installed Vim text editor:

dpkg -l | grep vim
EXPLANATION
  • dpkg -l: Lists all the installed packages on the system.
  • |: Pipe operator that takes the output of a command from its left and sends it to the input of the command of its right.
  • grep vim: Displays the line that contains the word “vim”.

check vim using dpkg

You can see that all the packages of Vim are installed on your system.

Note: You can install Vim in Ret-hat-based Linux distributions like CentOS and Fedora by using this command:

sudo yum install vim

2. Using “apt-get”

Apt-get is another package manager that you can use to install the Vim editor on your Ubuntu. First, follow step 2 method 1 to update the repo list. Then execute the following command:

sudo apt-get install vim

install vim using apt-get

Now, you can verify the installed Vim using the same way as was mentioned in Step 4 method 1.

3. Using PPA-Repository

PPA stands for personal package archive which is a subset of apt repositories, offering the latest version updates of software packages. So, to install the latest version of the Vim text editor, follow this method:

  1. Run this add-repository command to add the PPA jonathonf/vim on your system:
    sudo add-apt-repository ppa:jonathonf/vim

    add vim ppa repository

  2. Once you have added the PPA-repository, update the package list using sudo apt update and copy the code below to install the latest version of Vim:
    sudo apt install vim
  3. Check the version using vim --version command:check latest version of vim using ppaAs you can see the latest version of vim text editor has been installed on your Ubuntu.

4. Using “snap”

You can install Vim from the snap store in Ubuntu with the snap command. For that, execute the below command:

snap install --beta vim-editor

install vim using snap

After running this command, an authentication window will arrive, asking for your Ubuntu password:

install vim editor using snap

Now, you can create any file using the vim-editor command followed by the filename.

5. Using GUI

The most convenient way to install vim is to GUI. This technique is for people who find difficulty in using commands. There are two ways to achieve this task, one is using Ubuntu software and the other one is using a synaptic package manager. Follow the detailed steps below:

5.1 Ubuntu Software

Ubuntu software serves as a centralized location for installing, removing, and managing available software packages. It provides all the basic information that you need to install software. Here are the steps to install Vim with Ubuntu Software:

  1. First, go to “Ubuntu software” by clicking the “Show Applications” button:install vim editor using GUI
  2. After going to the “Ubuntu Software”, write “vim” in the search bar to find the vim packages:install vim using GUI
  3. Click the “install” button to install the Vim:install vim with ubuntu software
  4. An authentication window will appear then:authenticate before installing vim The vim installation process will be done after providing the Ubuntu password.

5.2 Synaptic Package Manager

Installing Vim with Synaptic package manager offers more control over packages. To learn how to accomplish this, follow the steps below:

  1. Find the synaptic package manager by clicking the “Show Applications” button:search synaptic package manager
  2. Search for the Vim package in the synaptic package manager and click “Mark for Installation”:install vim using synaptic package manager
  3. Finally, click “Apply” to install the vim text editor on your Ubuntu:install vim using synaptic package manager2

How to Install a Specific Version of Vim in Ubuntu?

To install a specific version of Vim in Ubuntu, use apt or apt-get package manager followed by the exact Vim version number. For instance, to install Vim version 2:8.2 using apt, copy the following code:

sudo apt install vim=2:8.2.*

install specific version of vim

Check the vim version by following step 4 method 1 to verify if the specified version is installed.

How to Uninstall Vim in Ubuntu?

To uninstall Vim in Ubuntu, consider using the apt or apt-get package manager. Here, I will show you the whole process for removing Vim from your Linux system using the apt package manager:

  1. Open the terminal using CTRL+ALT+T.
  2. Now, execute the following code to uninstall Vim in Ubuntu:
    sudo apt remove vim

    uninstall vim

    As you can see the vim has been removed from Ubuntu.

  3. To remove further dependencies, run this command:
    sudo apt autoremove

    remove vim dependencies

    Now, the vim with all dependencies is completely removed from your Linux system. To uninstall Vim with all of its configuration files, you can run sudo apt remove --purge vim.

Note: If you use Red-hat-based Linux distros, then run this command to remove vim:

sudo yum remove vim

Conclusion

To conclude, I have demonstrated 5 methods of installing the Vim text-processing tool in Ubuntu. You will also get to know how to install a specific version of a Vim package. Additionally, I have added how to uninstall it in Ubuntu. Choose any method that best suits your needs and interact through the comment section if you face any issues while installing!

People Also Ask

How to install Vim in command line?

To install Vim in command line, write sudo apt install vim in the command. Don’t forget to provide your password if prompted.

Should I use vi or Vim?

Vim is the improved version of vi. It has some extra features like syntax highlighting, multiple buffers, plugins, and more. So if you need these features, you should use vim otherwise stick with the vi tool.

Which editor is best Vim or nano?

Vim is a highly customizable and versatile text editor popular among developers and system administrators. But you should have a good command over vim to unleash its potential. On the other hand, nano is a simple text editor that requires minimal expertise, suitable for beginners.

Is vi on every Linux system?

Yes, vi is available on all Unix-like operating systems like Linux, macOS, etc. If you don’t have vi installed on your machine, you can install it with the package managers of your operating system.

Related Articles


<< Go Back to Vim in LinuxLinux Text Editors | Learn Linux Basics

5/5 - (1 vote)
Mitu Akter Mou

Hello, This is Mitu Akter Mou, currently working as a Linux Content Developer Executive at SOFTEKO for the Linuxsimply project. I hold a bachelor's degree in Biomedical Engineering from Khulna University of Engineering & Technology (KUET). Experiencing new stuff and gathering insights from them seems very happening to me. My goal here is to simplify the life of Linux users by making creative articles, blogs, and video content for all of them. Read Full Bio

Leave a Comment