How to install vim
How to install vim
How to Install Latest Vim Editor in Linux Systems
Vi has been around for a long, developed around 1976, it offered users traditional yet powerful features such as an effective editing interface, terminal control, and many more.
However, it lacked certain captivating features for example multiple screens, syntax highlighting, multiple undo functionality, and so on, that many Unix/Linux users were looking for in a complete text editor.
Therefore, Vim (Vi Improved) was developed to bring users a fully-featured, advanced, and complete text editor. Vim is a powerful, highly configurable, popular, and cross-platform text editor that runs on Unix-like systems such as Linux, OS X, Solaris, *BSD, and MS-Windows.
It is feature-rich and highly-extensible as well, using several community developed plugins, you can turn Vim into more than a simple text editor using vim tricks and tips.
Vim Features
A number of its notable features include:
Ten years since major changes were made to Vim, a new and improved release, Vim 8.2 is now out as in this announcement. It comes with some important improvements, several bug fixes, and new features as listed below:
New Features in Vim 8.2
How To Install Vim Editor in Linux Systems
In most modern Linux distributions, you can install Vim editor from the default repositories using the package manager, but the available version you will get is a little older.
Although Vim 8.2 is out, it will take a good amount of time before it gets into official software repositories for the different Linux distributions.
Luckily, users of Ubuntu and Mint and its derivatives can use the unofficial and untrusted PPA to install it as shown.
After installation, you can launch vim from the command line and view information about it as shown:
Running Vim 8.0 in Ubuntu 16.04
To uninstall it and move back to the older version in the Ubuntu repository, run the following commands to purge the PPA:
Compiling Vim from Sources in Linux
For other Linux distributions, it will take some time to include it into official software repositories, but you can try the latest Vim 8.0 by compiling it from the source on your own as shown.
On Debian/Ubuntu and Mint
On RHEL/CentOS and Fedora
Arch users can install the latest Vim using pacman as shown:
For other Linux distributions, you can download and build it on your own:
Last but not least, if you have installed Vim, try it out and get back to us by using the feedback section below. Make any suggestions or share your experience with us and much more. We shall be delighted to get vital remarks from you.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Vim is lightweight package and its installation is really simple. In this chapter, we will discuss following items −
Installation on Windows platform
Vim doesn’t have any specific requirements. It is simple software bundle which provides all dependencies.
Installation
To download Vim visit vim.org
Click on Download option from left pane
Download .exe installer from this page. At the time of writing this tutorial installer name was gvim80.exe
Double click on installer and follow on screen instructions to complete installation
Configuration
Vim stores its configuration in simple text file namely _vimrc and it is located under home directory of user.
To find current user’s home directory execute below command in terminal −
Navigate to home directory and create a new file namely _vimrc. Ensure that this file doesn’t have any extension.
Open this file in text editor, enter following text and save it −
Now Vim will show line numbers when file is opened. We’ll add more options to this file latter on.
Installation on Debian based Linux
Installation on Linux platform is quite simple as compared to Windows. This section describes installation and configuration on Debian based Linux.
Installation
Execute below command in terminal −
To ensure Vim is correctly installed execute below command −
It should print the location of Vim binary. In my case it was −
Configuration
To find current user’s home directory execute below command in terminal −
Open this file in text editor, enter following text and save it −
Now Vim will show line numbers when file is opened. We’ll add more options to this file latter on.
Installation on RPM based Linux
This section describes installation and configuration on RPM based Linux.
Installation
Execute below command in terminal −
To ensure Vim is correctly installed execute below command −
It should print the location of Vim binary. In my case it was −
Configuration
To find current user’s home directory execute below command in terminal −
Open this file in text editor, enter following text and save it −
Now Vim will show line numbers when file is opened. We’ll add more options to this file latter on.
Vim Windows Install Guide – How to Run the Vim Text Editor in PowerShell on your PC
Vim is a powerful code editor. So powerful that both Linux and Mac have it installed by default.
But if you are using Windows as your operating system, you will need to install Vim separately.
Fortunately, Microsoft makes it very easy to install Vim and get it running on your PC.
How to Download Vim
They have built a special self-executing installer that walks you through the process of installing Vim in the right location on your hard drive.
How to Install Vim
Note that for Windows you will technically download something called gVim, which is a version of Vim that includes a basic graphic user interface (GUI). You can install it by downloading this executable installer.
Once you’ve downloaded the file, you just need to run it, and you’ll see a nice installation wizard that looks like this:
A screenshot of the wizard you’ll see when you first run the Vim installer
They have a recommended «typical» installation. but if you have a reasonably large hard drive, there’s no harm in going ahead with installing everything by choosing the «full» option:
A screenshot of the Vim installer where you can choose what parts of Vim you want to install.
How to Run Vim in PowerShell
Then, once you’ve installed Vim, you should be able to launch it from your Windows command prompt.
Note that as of 2020, PowerShell has all of the same functionality as CMD, plus a whole lot more. I recommend using PowerShell for everything.
You can open PowerShell from the Windows menu bar by typing «powershell» in the search field on the start bar.
Windows will open PowerShell, and you’ll get a command prompt that looks something like this:
A screenshot of the Windows PowerShell prompt.
Once you’re in PowerShell, here’s how to run Vim itself. All you have to do is type «vim» and press enter. This will open up Vim. Once Vim is open, this is what you should see:
A screenshot of Vim when you open it for the first time.
Congratulations – you now have Vim installed.
How to run Vim inside VS Code
If you are already using VS Code, and want a lot of the speed of Vim without losing the functionality of VS Code, I have good news. It is possible to run a Vim-like experience right within VS Code.
Here is a Vim plugin for VS Code that will help you do this. At the time of me writing this, this plugin has been installed nearly 2 million times.
How to Learn How to Use Vim Properly
Vim is a powerful code editor, and it will take you a lot of practice to get comfortable with it.
Here are a few Vim tutorials that will really help you quickly grasp the basics and get your fingers flying in no time.
For starters, one way Vim is different from other code editors is that Vim has «modes». Here are all of Vim’s modes explained, with examples.
Vim can be intimidating. There is so much to learn. But this guide will show you how not to be afraid of Vim anymore.
If you’re already using VS Code and want to switch completely to Vim, this article will explain how you can do so.
And here are 7 Vim Tips That Changed #100DaysOfCode founder Alex Kallaway’s life. In this article, he not only explain these, but shows demos of these tips in action.
Vim: Learn it, live it, love it.
In the 30 years since Bram Moolenaar first created Vim, its influence has spread far and wide. And even today, the Vim project is actively maintained and constantly improving.
I’ve met so many developers over the years who swear by Vim.
I hope this guide has helped you get running Vim on your Windows PC. And I hope these other tutorials I’ve shared with you here will help you go from zero-to-sixty within the coming months.
The key is to keep practicing and not get discouraged by how many Vim shortcuts there are to remember. Eventually, all of these will become muscle memory, and you’ll be flying from one file to another, banging out code like a terminator.
There is no feeling quite as cool as being able to drop into a codebase and immediately start making changes without ever even reaching for a mouse or trackpad. That is the power that Vim promises, and delivers in spades.
The teacher who founded freeCodeCamp.org.
If you read this far, tweet to the author to show them you care. Tweet a thanks
Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started
freeCodeCamp is a donor-supported tax-exempt 501(c)(3) nonprofit organization (United States Federal Tax Identification Number: 82-0779546)
Donations to freeCodeCamp go toward our education initiatives, and help pay for servers, services, and staff.
Installing and Using the Vim Text Editor on a Cloud Server
Introduction
One of the most powerful text editors accessible from the command line is the vim editor. Built on the foundation of «vi», an editor dating back to 1976, vim adds additional functionality and power, while maintaining the editing style of its predecessor.
This guide will cover the installation and basic usage of vim.
Table of Contents
Installation
Due to vim’s wide-spread use on the Linux command line, it is available in almost every distribution’s default repositories.
On Ubuntu and Debian, use apt-get to install:
On Fedora and CentOS, install with yum:
On Arch Linux, vim can be install through packman:
Vim should now be installed correctly.
Opening Vim
By default, when vim is called without any arguments, it opens with a blank document. Depending on your distribution, there may be an introduction and licensing message. This will disappear when you begin using the editor.
However, we are not going to open vim with a blank document. We will create a sample document called «newfile» to showcase vim’s features.
Now, we will open the file we just created with vim.
Modal Editing
The main difference between vim and most other editors is that vim is a «modal» editor. Most other editors have only one mode. In these editors, special editing functions, like copying text, are performed by holding one or more modifier keys and then hitting a regular key. Vim uses distinct modes to separate these functions from the task of normal text input.
Normal Mode
Used for editing operations. Copying, pasting, moving, deleting, and changing text is accomplished from within this mode.
In vim, editing functions are performed by putting vim into «normal» mode. Normal mode is the mode that vim is in upon opening the program. This mode is used to navigate a text document quickly and to perform editing. It is not used for entering text.
Insert Mode
Used for inserting new text in the document. It is possible to enter insert mode in a number of ways.
To enter text, vim must transition into «insert» mode. Insert mode is analogous to the typing interface of most other text entry programs. What you type appears on the screen in the document. All normal keys will produce the corresponding character at the current cursor position.
Visual Mode
Used for visual selection. Many commands available in normal mode can be applied to a specific highlighted portion of the text.
A third mode that vim uses is «visual» mode. This is used for visual selection and manipulation of text. Areas of text are highlighted as a target of subsequent editing or formatting commands.
Command Mode
Used for issuing vim commands. Enter this mode with the colon key.
An additional mode that is used for complex edits, changing settings, and controlling vim itself is «command» mode. This mode is used for saving documents, quitting the program, performing complex searches and many other things.
Navigation
Basic Navigation
It is always possible to navigate text with the arrow keys, but vim provides faster ways of moving around a document. In normal mode, you can use the h,j,k, and l keys to move left, down, up, and right, respectively.
These direction keys may seem confusing and counterintuitive at first, but they were chosen for a reason. They are in the home-row of a typical keyboard. This means that a user’s hand moves from the resting position significantly less than with the traditional arrow keys.
Advanced Navigation
There are also other navigation shortcuts. Here are a few of the most useful ones:
Editing
Editing text in vim is accomplished by issuing commands in normal mode.
It is important to realize that editing commands in vim are very powerful when combined with motion commands. Anything from the navigation section can be used as a direction. For instance, you can perform an editing command on a word following it with «w».
Here are a few of the different actions you can choose from:
Removing text
Changing Text
Copying and Pasting
Miscellaneous Editing
Managing Documents
Putting It All Together
As mentioned earlier, vim’s power comes from its ability to chain different commands together. The easiest way to grasp this concept is to consider vim commands a language. Keys in normal mode can represent adjectives, verbs, and objects.
For instance, to yank (copy) 4 words, simply translate that phrase into commands that vim recognizes. In this case, it would be:
To delete from the current line until the end of the file, type:
It’s also helpful to realize some of the conventions that vim uses for its editing commands. For instance, a doubled letter is usually applied to the entire line. We can copy an entire line with:
On the other hand, a capitalized version of an editing command often targets from the current cursor position to the end of the line. For instance, to change the text from here until the end of the line, you would use:
To do the same motion on more than one line, just add a numbered prefix to the command. This changes the text from the current position to the end of the following line:
There are many other powerful techniques to use with vim that are outside of the scope of this guide. If you would like to learn more, a good start is with vim’s built in tutorial interface. It will not cover advanced topics, but it will give you a good idea of how to work with vim to do basic editing. You can start it with this:
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.
Downloading Vim
Most popular:
MS-Windows: | Recent and signed MS-Windows files are available on the vim-win32-installer site The current stable version is gvim_9.0.0000.exe. An alternative is the standard self-installing executable, currently also version 9.0. |
Unix: | See the GitHub page, or Mercurial, if you prefer that. There is also an Appimage which is build daily and runs on many Linux systems. | Mac: | See the MacVim project for a GUI version and Homebrew for a terminal version |
Versions before 7.3 can also be obtained with Subversion and CVS.
Version
To avoid having to update this page for every new version, there are links to the directories. From there select the files you want to download. In the file names ## stands for the version number. For example, vim##src.zip with version 9.0 is vim90src.zip and vim-##-src.tar.gz for version 9.0 is vim-9.0-src.tar.gz. Links are provided for quick access to the latest version.
Note that the links point to the latest version (currently 9.0) to avoid that caching causes you to get an older version.
You need to download at the sources and the runtime files. And apply all the latest patches. For Vim 6 up to 7.2 you can optionally get the «lang» archive, which adds translated messages and menus. For 7.3 and later this is included with the runtime files. Using git This is the simplest and most efficient way to obtain the latest version, including all patches. This requires the «git» command.
The explanations are on the GitHub page.
Summary: Using Mercurial This is another simple and most efficient way to obtain the latest version, including all patches. This requires the «hg» command.
The explanations are on this page: Mercurial
PC: MS-DOS and MS-Windows
If you want a signed version you can get a build from
vim-win32-installer
It supports many interfaces, such as Perl, Tcl, Lua, Python and Ruby. There are also 64bit versions which only run on 64 bit MS-Windows and use a lot more memory, but is compatible with 64 bit plugins.
You can also get a nightly build from there with the most recent improvements, with a small risk that something is broken.
There are three versions that run as an MS-Windows application. These provide menus, scrollbars and a toolbar. GUI executable gvim##.zip gvim90.zip (ftp) This is the «normal» GUI version. OLE GUI executable gvim##ole.zip gvim90ole.zip (ftp) A GUI version with OLE support. This offers a few extra features, such as integration with Visual Developer Studio. But it uses quite a bit more memory. There are three versions that run on MS-DOS or in a console window in MS-Windows: Win32 console executable vim##w32.zip vim90w32.zip (ftp) The Win32 console version works well on MS-Windows NT/2000/XP/Vista/7. It supports long file names and is compiled with «big» features. It does not run perfectly well on MS-Windows 95/98/ME, especially when resizing the console window (this may crash MS-Windows. ). 32 bit DOS executable vim##d32.zip vim73_46d32.zip (ftp) The 32 bit DOS version works well on MS-Windows 95/98/ME. It requires a DPMI manager, which needs to be installed on MS-DOS. MS-Windows already has one. It supports long file names, but NOT on MS-Windows NT/2000/XP/Vista/7. It is compiled with «big» features.
Not available for 7.4 and later. 16 bit DOS executable vim##d16.zip vim71d16.zip (ftp) The 16 bit DOS version is the only one that runs on old MS-DOS systems. Only use this if you are really desparate, because it excludes many useful features (such as syntax highlighting and long file names) and quickly runs out of memory.
The last version available is 7.1. Version 7.2 and later are too big to fit in the DOS memory model. There are a few extra files: iconv library libiconv A library used for converting character sets. Put «iconv.dll» in the same directory as gvim.exe to be able to edit files in many encodings. You can find the dll file in the bin directory of the «libiconv-win32» archive. newer intl library libintl The included libintl.dll does not support encoding conversion. If you have installed the iconv library, as mentioned above, you can install a gettext library that uses it. Get «intl.dll» from the bin directory in the gettext-win32 archive and store it as «libintl.dll» in the same directory as gvim.exe, overwriting the file that may already be there. PC sources vim##src.zip vim90src.zip (ftp) The source files, packed for the PC. This only includes the files needed on the PC, not for other systems. The files are in dos format CR-LF. PC debug files gvim##.pdb gvim90.pdb (ftp) gvim##ole.pdb gvim90ole.pdb (ftp) vim##w32.pdb vim90w32.pdb (ftp) When you notice a bug or a crash in Vim these files can be used to help tracing down the problem. In Vim 7 do «:help debug-win32» to see how. PC translations vim##lang.zip vim72lang.zip (ftp) Only for 7.2 and earlier, for 7.3 and later these are included in the «rt» archive. Translated messages and menu files, packed for the PC. Use this to see non-English menus. The messages are only translated when the libintl.dll library is installed. Windows 3.1 GUI executable gvim##w16.zip and gvim##m16.zip These are GUI versions for 16 bit windows (Windows 3.1). The «w16» has many features, «m16» has few features (for when you’re short on memory). The files ending in «.zip» can be unpacked with any unzip program. Make sure you unpack them all in the same directory!
Yongwei’s build You may also try Yongwei’s build, executables with slightly different interfaces supported. Cream For an unofficial version that used to include all the latest patches and optionally a bit more: Cream. The «one-click installer» mentioned includes the Cream changes. For the «real Vim» use the «without Cream» version listed further down.
Unfortunately, it stopped updating since Vim 8.0. Cygwin For a Cygwin binary look at others.
Amiga
For Vim 5.x and Vim 6 look in the os2 directory (ftp). Version 6.2 is not available. Versions 6.3 and 6.4 were compiled by David Sanders.
Version 7.0 was compiled by David Sanders. Runtime files vim##rt.zip vim70rt.zip (ftp) Documentation, syntax files, etc. You always need this. Executables vim##os2.zip vim70os2.zip (ftp) Vim, Xxd, Tee and EMX libraries. The files ending in «.zip» can be unpacked with any unzip program. Make sure you both zip archives in the same directory!
If you want to compile the OS/2 version, you need the EMX compiler. Use the Unix source archive, runtime files and the extra archive. After unpacking the runtime archive, move all the files and directories in the «runtime» directory one level up.
Macintosh
MacVim
MacVim has more a Mac look and feel, is developed actively and most people prefer this version. Most of MacVim was made by Bjцrn Winckler.
New versions are made quite often. Subscribe to the vim-mac maillist to be informed about bugs and updates.
Homebrew
Older
Older binaries for Mac OS/X can be found on this SourceForge project. Maintained by Nicholas Stallard.
Here is a multi-byte version of Vim 5.7 (for Japanese, possibly also for Korean and Chinese; not for Unicode):
http://www-imai.is.s.u-tokyo.ac.jp/
Background
Most of the work for the Macintosh port (Classic and Carbon) was done by Dany St-Amant.
If you have OSX and a setup for compiling programs, you can use the source code and compile yourself. See the Unix section above. The development tools can be downloaded from Apple’s developer web site.
Turn to the vim-mac maillist to meet other Vim-Mac users.