Helping people with computers... one answer at a time.

With a nod to the super-geeky, I present a quick overview of the ubiquitous VI, Vim, and gVim text editor.

VI is an incredibly powerful - and old - text editing program that dates from the original development of Unix, the precursor to many of our current operating systems.

I use VI or its graphical version, gVim, on every computer system that I own or maintain - it's truly ubiquitous and comes pre-installed on almost all systems (except for Windows where it's a free download).

It's not for everyone - I did say it's geeky - but as I also said, it's incredibly powerful and available just about anywhere. And it beats the pants off of Notepad. Smile

In this video from an Ask Leo! webinar, I'll present a short view into Vim.

Download the video: VIM.mp4 (20M).

View in HD (1280x720)

Transcript

Next up, I'm going to talk about VIM. I do this with a little bit of trepidation only because when it comes to text editing programs, people (some people) are almost religious about what is and is not an appropriate text editor.

I use VIM a lot; it's not what I edit my HTML pages in, but it is pretty much what I edit everything else in. The reason I use VIM is that it's available on every platform I can find. Every platform that I care about. VIM is VI improved. VI is a visual text editor that was available originally on Unix. And it's been ported just about everywhere. So when I go from machine to machine, I have a version available for Windows which I'll be showing you here. When I go to my servers, there's a version available for Linux. In fact, it comes pre-installed; VI comes pre-installed on almost every Linux distribution. It's available on Mac; if you've ever gone into the terminal Window on a Mac, you'll recognize that the guts of OSX are based on BSD, which is a Unix derivative and sure enough, you will find the VI text editor there.

So by knowing one text editor (that being VI) and having it available everywhere, I can use the same interface, the same commands, the same text editing commands that I might want to on any machine that I might care to play with.

So what does VI look like? Well, this is GVIM, which is the graphical version of VIM. It is originally (to continue with the history a little bit) VI was created in the days of Unix when there was no real thing as a graphical user interface. Everything was character mode. Think of MS-DOS as an example of character mode where they're actually is no opportunity to display images or pictures; everything was characters.

VI Improved or VIM was simply a version of that; that includes some more functionality that's extremely powerful. GVIM then is the graphical version of VIM, which basically puts together VI with the beginnings of a graphical user interface. And I shouldn't really say the 'beginnings of it'; it is VI with graphics. So you can, now with regular file opener (I'm going to go ahead and open one of the files I opened earlier so you can see the difference -my AutoHotKey macro file).

So there are a couple of things to notice about this. One, it's a text editor; it's a plain text editor. There are no bold or italics or anything like this. This is functionally in that sense in the same class as Notepad. You'll notice it's doing syntax highlighting. It actually understands many, many different file formats or many different programming and other text file formats. So if I'm actually opening a Perl file, it will color one way and if opening up an HTML file, it will color a different way; if I'm opening a Javascript file, it will color it a different way - very powerful in that sense.

As you can imagine, standard text selection with a mouse works. You can of course, cut, copy, paste, etc. You can change how things get selected; if you want to select by word sentence or paragraphs. 'Blockwise' which I've just noticed for the first time; it's actually an interesting one because it allows you to select a columnar format so if I select to there and I change that selection to Blockwise, what it's done is selected the rectangle or the block that begins and ends where I've selected. And it reverts to regular selection when you select again.

VIM's keyboard sequence...so you can see everything in a normal operations on a menu here. You can play with files; you can cut, copy, paste; you can do basic things that you would do in any normal text editor.

The place where VI, VIM and GVIM tend to be a bit of an issue for the casual user is that the command sequence is the keyboard-based sequence tends to be very arcane. For those of us who have been using it for years and use it across multiple platforms, it's fine because it's the command set we know and use everywhere, but for someone just coming into text editing, it may not always be appropriate. You can get a taste for it here with some of these keystroke sequences that give you a flavor of what the equivalent is say of cut if you were to use just the keystrokes, paste and so forth. That's not to say that the Ctrl and insert and delete don't work...they do, but the VIM equivalent keystrokes are listed here. VIM does include a very extensive help file but in classic VIM style, it includes it as a separate text file that is displayed in a separate window within VIM. So you can scroll through it; you can double-click on things to maneuver around the help file and so on, but it's all there and it's all very, surprisingly actually, complete. And here you'll see me use one of the more obscure keystrokes to close that window without actually making any changes to the text file.

So that in a nutshell, I don't want to get to deep in VIM because I know it's not for everybody, but I at least wanted to expose people to it and give you this sense that for people that are editing lots of texts on lots of different platforms, VIM is a very useful and a very powerful alternative that is present almost everywhere. The only place you actually have to install it on is Windows and there it's a very simple download for the platform like any other.

VIM is free; it is donation-ware. They've been helping the children in Uganda for a long time. So that I will throw out as a recommendation for the techie types in the crowd.

Article C5032 - January 7, 2012 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

7 Comments
Kevin, Arlington VA
January 8, 2012 1:20 PM

vi, vi, vi -- the editor if the beast!

Glenn Meyer
January 10, 2012 10:31 AM

Great article on VIM. I don't use vi myself unless I have to, but I recognize that sometimes, I have to. Let me offer an alternative: emacs also runs on all platforms that I've ever tried, and it also comes in windows-oriented and character-only interfaces. I learned emacs on tops-20, and it stuck, although for a few years after that, when the UNIX version of emacs sucked, I used vi. Anyway, emacs is my alternative to notepad, a matter of personal choice. I use vi because on many *nix systems, emacs isn't installed by default.

Clem Czapp
January 10, 2012 10:46 AM

Hi Leo, just watched your webinar re VIM or VI. Very interesting, so downloaded to have a closer look. Noticed that it has a spell checker included - which is worth mentioning as Notepad or Wordpad of course don't have. There's a plus straight away! keep up the good work.
best regards
Clem Czapp [UK]

Pollyanna
January 10, 2012 3:53 PM

This question may not be appropriate here, but....

Why is the text on all your webinars so blurry? It makes it very hard to follow along, kind of defeating the purpose of video. Is it something I'm doing wrong?

The webinars are uploaded in several resolutions. If the copy running on the Ask Leo! website seems blurry you can click to watch the large HD version (the link is under video). That's exactly why I include the HD version. Many of the webinars are also uploaded to Youtube. If you click the bottom-right Youtube link on the video you can watch it straight from Youtube which may view better on your configuration.
Leo
10-Jan-2012
Connie
January 10, 2012 4:35 PM

@Pollyanna
The webinars are uploaded in several resolutions. If the copy running on the Ask Leo! website seems blurry you can click to watch the large HD version (link under video). Many of the webinars are also uploaded to Youtube. If you click the
bottom-right Youtube link on the video you can watch it straight from Youtube which may view better on your configuration.

Pollyanna
January 13, 2012 3:21 AM

With similar answers from Connie and Leo, I get the feeling there was a FAQ I missed somewhere. Or maybe Connie and Leo are the same person. Or maybe there's an echo. :-) Anyway, thanks, that was helpful.

BTW, Gmail sent the email notification of your reply to Spam, Leo, even though your newsletter comes through to my inbox just fine. Strange.

Trust me, we are two different people. I didn't notice that Connie had answered when I added mine. Connie edits the videos, so has first-hand knowledge of what's happening here Smile.
Leo
13-Jan-2012
Mike
January 21, 2012 9:31 PM

Leo,
I found this while looking for a Notepad.exe replacement for Windows XP. Nice, expecially as I use Vim on Linux.
I'm using Linux > Virtualbox > Windows XP > Firefox > Ask-Leo.com > Vim intro mp4,
in which I notice that you're running Vim

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to http://askleo.com/ask to ask your question.