22

I'm on Ubuntu 12.04 and want to know how to update Vim via the command line. What is the command to update this?

5 Answers 5

23

To get the latest stable version, it is recommended by the official instructions to directly install it from the source GitHub repository.

$ git clone https://github.com/vim/vim.git
$ cd vim/src
$ make
$ sudo make install

You can also use apt-get update && apt-get install vim to update Vim to the latest version available in your distribution's packages registry. To update all available packages, you can run apt-get update && apt-get upgrade

However, you may not get the latest version of Vim with APT (you'll moszt likely the latest major version, but not the minor / patch versions).

2
  • 1
    I needed to run ./configure before make. Also, using checkinstall instead of make install might be a good idea, if you ever plan on updating Vim.
    – MikaelF
    Jan 30, 2020 at 6:07
  • vim git repo is so huge man.
    – CKM
    May 10, 2020 at 3:10
11

Run these commands in a terminal:

sudo apt-get update
sudo apt-get install vim

Note that Ubuntu may not always have the latest packages due to the [official] repositories being frozen.

1
  • 2
    To get the latest version available, check my answer
    – d4nyll
    Jan 31, 2018 at 20:38
7

the best answer to this question is https://vi.stackexchange.com/a/10827/32151

and according to the linked answer, another way to doing this is using Personal Packet Archive (PPA)

add this PPA

sudo add-apt-repository ppa:jonathonf/vim

Update the package lists:

sudo apt update

install vim:

sudo apt install vim
1
2

I would generally recommend using sudo apt-get update ; sudo apt-get dist-upgrade, as this will update everything that apt-get can update on your system. If you don't already have VIM installed, you can get it using sudo apt-get install vim.

2

If you are working on Ubuntu16/CentOS7, you can use below commands to install latest vim.

Ubuntu16

sudo apt-get install gcc git ncurses-dev
git clone --depth=1 https://github.com/vim/vim.git
cd vim/src
sudo make
sudo make install

Centos7

change first command to:

sudo yum install gcc git ncurses-devel

Logout and login if you are still seeing older version.

1
  • 1
    "Logout and login if you are still seeing older version." yep, this was the solution for me. I don't know how this could even be a problem.
    – Asocia
    Oct 21, 2020 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.