VIM Normalization

Linux users–including the ones at the Hackaday underground bunker–tend to fall into two groups: those that use vi and those that use emacs. We aren’t going to open that debate up again, but we couldn’t help but notice a new item on GitHub that potentially negates one of the biggest complaints non-vi users have, at least for vim which is the most common variant of vi in use on most modern systems. The vim keybinding makes vim behave like a “normal” editor (and to forestall flames, that’s a quote from the project page).

Normally vi starts out in a command mode that it calls normal mode. Pressing a key will execute an editing command, unlike most other modern editors which just insert characters into the open file. For example, pressing x will delete a character. This surprises most people who aren’t familiar with vi. In all fairness, there are other older editors that work this way, but they usually were not screen-oriented.

We keep waiting for the emacs/vi holy war to die off as the old guard retires or forgets how to use computers. You’d think more people would be using kate, atom, or some other really modern editor. But it doesn’t seem to die down–at least not around here.

We suspect the author is going to get threatening e-mails and won’t be able to go shopping without a disguise as the vi faithful will surely find this an abomination. Of course, emacs has several vi emulation modes, and no one has had any more than a car keying over that, that we know of.

We won’t revisit the editor war because we already have covered both sides of it. We’ll just try to get along, at least here in the bunker.

92 thoughts on “VIM Normalization

  1. I actually use both. And *love* both: how sick is that? But when I went to the doctor and tried to explain that…

    The only thing I hate with passion is having to edit things in the browser. Especially if it is the latest Javascript-wrapped abomination some Web@#$^H^H^Hdesigner is trying to impose upon me.

    (This site’s simplicity is one of the things which keep me coming back, BTW. Thanks for that!)

  2. pah emacs, vi – who cares! if there’s no gui kate and atom aint much use when ssh-ing into a box somewhere, I much prefer nano, I just want to edit a file – simple – I *don’t* want the kitchen sink…

      1. Count I as another 3rd-optioner.

        jed… if only it were a static binary and included in all modern distros.

        My problem is remembering what equation results in the save and quit… I once managed to get the text to change, I can’t remember how. It is like Vi and Emacs target audience are those who learnt to run before they could crawl.

        Should be CTRL+S for (s)ave, CTRL+(Q)uit, CTRL+(O)pen, CTRL+(H)elp.
        The text area should automatically be in edit mode (or whatever the mode is called when typing stuff changes the text on screen in Vi/Emacs).
        All other shortcut keys can be anything the programmer wants them to be because at least simpleton and forgetful people will be able to edit scripts and configs in a pinch.
        Other said shortcuts could be the first thing displayed on the help screen since things are easier when people can crawl before they walk

        1. I respect your choice to use nano or some other editor at the command line. That’s the beauty of *nix systems — choices aplenty!

          I will say that *some* of the vi/vim keybindings are actually quite logical. You use a colon to enter command mode, which is how you tell the editor things (similar to a slash in various IRC clients). w to write the file. q to quit. You can put it all in one command:


          i is for insert mode, which is to say allows you to insert text into your file. ESC (or CTRL+[ if you have no escape key) gets you out of insert mode, so you can direct commands to the editor again.

          From there it gets a bit more esoteric, but generally the only other key you need for vi/vim is x which deletes the character under the cursor.

          There, using just 6 keys (:, w, q, i, ESC, x), you’ve mastered simple editing in vi/vim.

          1. Vi takes a little while to learn, but you can belt out code much faster once you’ve got the idea of it. You (I) tend to think in Vi-mode as you’re composing the text. Particularly for doing a particular edit several times, eg change something in several consecutive (or non-consecutive) lines of code, a bit of clever commanding and it’s all done by the time you’ve pressed the final key.

            I also love the way you can compound commands, and they generally work the way you expect. :wq is just the beginning, baby! You can program cursor movement in to your command sequence, complete with repeats and whatever else, have the computer do the dumb repetitive work of moving it. I have a small suspicion Vi editing commands might even be Turing-complete.

          2. My godfathers! IT IS!


            Somebody’s written a Turing machine completely in Vi macros! This of course means that all other computers, and their editors, can be run as a simple series of Vi editing commands! Therefore Vi encompasses, and surpasses, all other editors and also all other software altogether.

          3. @Greenaum I remember showing it turing complete back in highschool, though I don’t have a copy so I’m glad someone wrote up a version. The core of mine was based around :map, “, and @. Like you can do :map 0 i1^[ :map 1i0^[ (key 1 inserts a 0, key 0 inserts a 1) then :map go “ax@a (“go” now deletes the current character into buffer a, then runs buffer a). Insert the character one, and “go” now performs not – the one your standing on gets run as a macro, and the macro for 1 is “Insert 0”. If you do it again, the zero you’re standing on gets run instead, which is “insert 1”. The rest is mostly grunt work, you can implement a straight turing machine (with a line as the tape) without further innovation, or implement something like brainf*ck/boolf*ck using the runs with tactical amounts of hjkl cursor movements as a crude instruction pointer.

        2. vi, and by extension, vim, are old enough that the folks who wrote them took older protocols/standards into account in order to keep from hosing things.

          Take a look at an ASCII table and you will note that CTRL+S is the ASCII character sent on a serial line for xoff, aka software flow control, or ‘stop sending me data’. CTRL+Q is xon, or ‘start sending data again’. CTRL+H is backspace. The cursor control keys (h,j,k,l) map to the ascii control codes for backspace, linefeed, vertical tab, and form feed. They also map to the left, up, down, right arrow keys on an ADM3a (and may other) terminals of the day.

          Also remember that many of the features you take for granted, like the disk/memory space space for a help screen are pretty modern conveniences. The binary for vi/vim on my mac is 1.5MB. The amount of memory on the first system I had that ran VI was 256MB, and it ran off of a 20MB disk. emacs is >11MB.

          I ported emacs to unix v6 and System III back in the early 80’s. Just finding a machine with enough memory to run it was a challenge.

          The default editor, which came with _every_ unix was not vi. That didn’t happen until it sprung forth from the fingers Bill Joy and company @ Berkeley. It was ed. ed is a seriously minimalist editor, which vi strives to be somewhat compatible with.

          One of these days I’ll get around to writing a UNIX history book…

          1. A lot of design choices in vi make perfect sense in the context of the systems it needed to run on originally, little memory, less capable keyboards, etc., and little sense in the context of modern systems.

    1. Especially when ssh-ing if you never tried Emacs’ tramp, you don’t know what you are missing :-)

      (Spoiler: Edit remote files as if they were local, even over several SSH hops. No more stale SSH sessions).

      And don’t get me started on org mode. Have a program snippet embedded in your documentation with its exec output inserted live. Great for teaching & presentations, bye copy-pasta, bye stale results.

  3. nano or pico
    fastest choice for editing stuff.
    however, vi when fresh-installing unix systems or when those above mentioned two editors are the only things available.

      1. Yes, when you need to add or change stuff in config files. My first choice.
        Also “ee” from FreeBSD.
        Please do not understand me in a wrong way. I do not wish to add a negative aura for vi(m) and emacs.

    1. In that case he should have just said “here is something cool for those using vi”, instead of his “two groups” nonsense. What did he expect after a remark like that?
      I’m sure the largest group is the third one, the group of those using anything that isn’t vi or emacs.

    1. Trying out posting a comment to hackaday using ed?
      Ok, how to use this thing??
      ^L?wtf y u no clear??
      Ah, I think I found the key sequence to post, it is:?

          1. Yep, the user is at fault of opening a text file and everything he types gets turned into commands, that is before trying to find the help:
            F1 – nope
            :help – wtf just happened and what is this error?
            :h – Cant remember what it did but it wasn’t what I wanted
            :edit – error/does nothing?
            :exit – nope
            :end – nope
            :quit – nah
            [ALT]+[SysRQ]+b – ah there be the quit sequence!

    1. Edit? You mean EDLIN.

      EDIT was the screen editor that was basically QBASIC in disguise. EDLIN was the line editor that worked even if you used CTTY COM: to edit your batch files from a serial terminal.

      Now get of my lawn :)

  4. Arguing about vi vs emacs is like arguing about Holley vs Rochester carburetors. Not a bad thing to know how to tune or rebuild a carburetor even if old cars aren’t your hobby, but they’re obsolete and I’m not going to defiantly put one on my 2013 Accord because ‘good ‘ole days’!

      1. Actually, that might make for an interesting article, HaD writers: something that teaches the lesser known, but sometimes useful things that can be done in the comment section.

  5. Sublime Text here, though I should switch over to Atom. I learnt ctrl + s is save, ctrl + w to close a tab etc. and can’t break that habit long enough for vim keybindings to set in.

    Oh and since those aren’t everywhere, Nano if it’s a small edit.

  6. “We keep waiting for the emacs/vi holy war to die off as the old guard retires or forgets how to use computers.”

    I’m a young whippersnapper, and I use Vim. I suspect I’m far from the only one. But do go on about how using drool-proof software makes you superior. It’s just a tool. Use whichever you like and leave the pretentiousness in the past, so it can finally die.

  7. At first I was suspicious and confused about why someone would wanna take the modal functions out of a modal text editor, but after looking at the project itself, I can see why it could be useful to people.

    I guess you could see it as the compliment to evil mode being in emacs.

    It still gives you access to the command mode when you need it so it could be a useful stepping stone for those wanting to learn VIM.

    I’ll stick with traditional VIM mode though, I’m used to it by now.

  8. Why i haven’t moved to a more recently created editor…
    1) I have been using BOTH vi and emacs for over 25 years. Any new editor would have to offer me something worth learning a new set of editor commands.
    2) If i ssh into a system i know vi will be there. And both emacs and vi are usable without a gui.
    3) I really need a heavy weight editor. I need an editor that can deal with syntax highlighting and indenting a file that has html, ruby, and javascript all at once. Or where i can record a keyboard macro and run it 1000 times.
    4) newer editors tend to shy away from keyboard commands. I can work a lot faster when I’m not having to move my hand between the keyboard and the mouse all the time. also its hard to do keyboard macros when you don’t have good keyboard commands
    5) they always seem to be missing some feature here or there that i don’t want to give up. For example i looked briefly at the docs for atom and kate and while they both mentioned being able to split the view in the window, neither of them indicated that they could have multiple windows. (having multiple windows is really handy when you have two monitors with one portrait and one landscape)

  9. I throw some logs into the flames
    +1 emacs 20+ years user. I can’t live without multiple command, multiple cursors, regexp, snippets and a tons of other stuff. And I can even roll my own functions in lisp. When you have to create or edit a couple of 10000 lines of header files for embedded systems, these features are essential.

  10. Vim is great but……. It doesn’t replace IDE. Once you need good auto completion or just go to definition, Eclipse is the right place.
    For example, when you working with shared libraries, for example boost, to parse it with vim, for auto compilation, it is disaster.
    For just text editing, vim is the right choice.

    1. I loved a good IDE when I was stuck on a single tasking OS. With a modern OS and GUI desktop I can do as well with a text editor in one app, and running build utilities on the command line. And a debugging environment independent of both.

  11. I thought this was a great idea, I never understood why vim does not work “the usual way” in insert mode (except “because it was coded before there where ‘usual’ way in editors) but this plugin completely removes normal mode! why??
    I don’t know much about plugins and vim script is magic to me, is bringing back normal mode when escape is pressed a easy fix?

    1. I have always been perplexed by this “usual way” talk. What the h*%$$# are people talking about? What establishes this “usual way”? But I am just hard core I guess. My first editor was SOS on DEC computers, then it was on to ed, ex, and then vi on edition 7 unix. And I have been using vi (and now vim) ever since. So when people talk about some normal standard, I am perplexed. I know they aren’t talking about emacs. Why not put a name on it? Are we talking about windows notepad or whatever it is called?

  12. Vi having two modes is genius. Mapping it into some “normal” editor is stupid, it is just going to lead to misery and trouble. A bad idea from the start. I guarantee it will sort of work, but you will be continually falling into holes that don’t make sense. If you have a normal editor you like, just use it and be happy. Or learn to use vi and be happier.

  13. “Linux users–including the ones at the Hackaday underground bunker–tend to fall into two groups: those that use vi and those that use emacs.”

    An you forget about the Zillions that use Windows Notepad and just copy-paste over via SSH. What a mess. I think there’s a similar-same problem with Apple OS machines, Apple chose to use non-Unix line-ends just to be incompatible (the Greedy Bastards).

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.