Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

A brief overview of Vim

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.

]]>

View in HD (1280×720)

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.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

6 comments on “A brief overview of Vim”

  1. 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.

    Reply
  2. 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]

    Reply
  3. 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
    Reply
  4. @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.

    Reply
  5. 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
    Reply
  6. 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

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.