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
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
- 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
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
<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:
- How to Install Nano Text Editor on Ubuntu
- How To Install NGINX on Ubuntu 18.04
- How to Install MongoDB on Ubuntu 18.04 LTE
- How to Install PHPMyAdmin on Ubuntu
- How To Install Nginx on Ubuntu Server
- How To Install LAMP Stack on Ubuntu
- How To Install LEMP Stack on Ubuntu 16.04
- How to Install WordPress on Ubuntu 18.04 LTE
- How to Install Let’s Encrypt SSL on Ubuntu
I hope you will find this guide on how to install Vim on Ubuntu useful.
Do share your views in the comment section below.