Website Vidya
DevelopmentStep-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
Website Vidya TeamLead 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!

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:

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.

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.

[icon name="fa-hand-o-right"] 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.

Written by

Website Vidya Team

Technology educator and researcher at Website Vidya.

Discussion

0
Share your thoughts, ask a question, or suggest a tip...
Write →

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

Development•

How to Install Python on Ubuntu 24.04 LTS

Python is one of the most popular programming languages today, widely used in web development, data science, machine learning, automation, and more. Ubuntu 24.04 LTS (Long Term Support) comes with Python pre-installed, but often you might w...

RR
Rajesh Rai
Read More