Website Vidya
How-To GuidesStep-by-Step Guide

How to Install Vim on Ubuntu: 2 Easy Step

Vim Editor is considered as one of the best terminal based text editor for Linux. It is an improved version of good old Vi Editor. Many great features like syntax highlighting, multi-level undo, command line history, spelling checker, block...

RR
Rajesh RayLead Systems Educator
Published:
4 min read
How to Install Vim on Ubuntu: 2 Easy Step
AI Executive SummaryCORE CIS AI

4 min read

Vim Editor is considered as one of the best terminal based text editor for Linux. It is an improved version of good old Vi Editor. Many great features like syntax highlighting, multi-level undo, command line history, spelling checker, block...

Key Highlights
  • How to Install Vim on Ubuntu: Step-by-Step
  • Features of Vim 8.2
  • Steps to Install Latest Vim on Ubuntu
Grounded in full engineering runbookCORE CIS Ai Engine

Vim Editor is considered as one of the best terminal based text editor for Linux. It is an improved version of good old Vi Editor. Many great features like syntax highlighting, multi-level undo, command line history, spelling checker, block operations, filename completion and script language has been added. Moreover, an extensive range of plugins are available for VIM. So in this article, we will see how to install Vim on Ubuntu.

Key Features of Vim Text Editor

  • It is a cross-platform text editor available for different operating systems like Linux, Windows and Mac.
  • It is a compatible version of Unix Editor Vi.
  • This editor can be accessed from both command line and Graphical User Interface (GUI).
  • It is by far the best text editor for system administrators.
  • High-level Text Editing is possible with Vim Editor.
  • More suitable for editing Markup Languages such as HTML, XML, XHTML and more.

How to Install Vim on Ubuntu: Step-by-Step

It's just a one line command to install Vim on Ubuntu. For installation, run:

sudo apt-get install vim

Thats it!

Advertisement

But one of the major drawback of following this approach is that it doesn't install the latest version rather it installs the most stable version of the Vim.

If you are looking to install the latest version of the Vim, you need to follow a couple of steps. But before we dive into the installation process, let's have a look at some of the key features of latest Vim.

Features of Vim 8.2

  • Support for popup windows
  • Support for asynchronous I/O, channels, JSON
  • Packages
  • Partials
  • Timers
  • Support for GTK+ 3
  • Lambdas and Closures
  • DirectX support for Microsoft users

You can check more details on official website of Vim Editor.

Steps to Install Latest Vim on Ubuntu

Adding PPA to your Server

You need to add ppa:jonathonf/vim to the software sources of your Ubuntu Server to update your server with unsupported packages from this untrusted PPA. For that you simply need to run the following command:

Advertisement
sudo add-apt-repository ppa:jonathonf/vim

Once done, update your Ubuntu bu running:

sudo apt update 

Now you can install the latest version of the Vim Editor by typing:

sudo apt install vim

That's it. This is all what you need to install Vim on Ubuntu.

How To Uninstall vim On Ubuntu

To uninstall vim, just follow these simple instructions.

Uninstall just Vim

sudo apt-get remove vim

This will just remove the Vim editor. No dependencies or configuration files will be removed.

Advertisement

Uninstall Vim and its Dependencies

sudo apt-get remove --auto-remove vim

This will remove the vim package and all the other dependencies which are no longer required. This will also free-up the space on your server.

Purging your config/data

In case you want to remove all the local/config files, run:

sudo apt-get purge vim

To remove both local/config files and dependencies, run:

sudo apt-get purge --auto-remove vim

Opening Vim

By default, when you run vim command without passing any arguments, it opens a blank document containing licensing message and introduction.

This introduction and licensing message disappears as soon as you start using the editor.

Let's take an another example and create a sample document called "newdocument". To do that, run:

sudo vim newdocument

Once you run the above command, it opens a black document with file name newdocument.

In this example, I'm adding few lines of html code:

<h1>Main Heading Goes Here</h1>
<h2>Sub-Heading Goes Here</h2>
<p>Paragraph Goes Here</P>
<a href="#">Link</a>
<hr>
<h3>Another Sub-Heading Goes Here</h2>
<p>Paragraph Goes Here</P>
<a href="#">Link</a>
<hr>

To save changes press colon : and then wq! to save and quite the changes.

Basic Command Reference

  • copy: y
  • copy a line: yy
  • paste: p
  • cut: d
  • cut a line: dd
  • save: :w
  • save and exit: :wq
  • exit: :q
  • force: ! (example :w! :q!)
  • vertical split: open a document and type :vsplit /document-path/document. This will open the document that you have specified and will split the screen to display both the documents.

You may also like:

I hope you will find this guide on how to install Vim on Ubuntu useful.

Do share your views in the comment section below.

RR
Written byVerified Author

Rajesh Ray

I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.

SPAM-FREE MODERATED DISCOURSE

Join the Conversation & Perspective

Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.

AT
MP
JV
+2

No comments on this guide yet. Be the first to share your thoughts or ask a question!

Recommended Reading10 Guides

Related Technical Guides

Tested runbooks, server administration walkthroughs, and troubleshooting guides

Featured Infrastructure PartnerUp to 75% OFF + 3 Months Free

Supercharge Your Linux & Cloud Workloads with Hostinger

Deploy high-speed NVMe KVM VPS, Docker containers, and LiteSpeed-accelerated WordPress servers in under 60 seconds with full root access, dedicated IPv4, and 24/7 technical support.

Pure NVMe SSD StorageFull Root Access & SSHFree Domain & Unlimited SSL99.9% Uptime SLA
Plans from$2.99/mo
Claim Hostinger DealAffiliate link • Special discount applied at checkout