25

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?

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
Patoshi パトシ
  • 2,993
  • 15
  • 32
  • 44

5 Answers5

26

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).

d4nyll
  • 2,664
  • 3
    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 '20 at 06:07
  • 3
    vim git repo is so huge man. – CKM May 10 '20 at 03: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.

kiri
  • 28,246
  • 16
  • 81
  • 118
8

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
    This no longer works: Err:13 https://ppa.launchpadcontent.net/jonathonf/vim/ubuntu jammy Release 404 Not Found [IP: 185.125.190.52 443] – user2121 Jul 07 '22 at 10:30
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.

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
me_astr
  • 191
  • 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. – sahinakkaya Oct 21 '20 at 12:37
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.

TSJNachos117
  • 1,444
  • 2
  • 15
  • 19