Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Learn vi/vim in 50 lines and 15 minutes

by flyingmoose (Priest)
on Mar 04, 2004 at 17:33 UTC ( #333942=note: print w/replies, xml ) Need Help??

in reply to Learn vi/vim in 50 lines and 15 minutes

A few thoughts/observations/comments on vi in general, for anyone scared about it or debating not learning it.

  • vi/vim is cool because it is everywhere. If you walk up to some obscure ancient UNIX box, probably all it will have is vi. This means your editor (pico, nano, emacs, etc) -- will not exist. This is life.
  • Enjoy the simple speedups like :/foo/ to search for foo, or :520 to go to line 520, or ":set nu" to show line numbers, or ":$" to jump to EOF. In most GUI tools (nedit, SlickEdit, etc) you'd have to expend far more calories to make these things happen. In more primative tools (pico, nano, etc) some of these things require far more keystrokes and some of them aren't even doable.
  • There greatest thing about vi/vim is you don't have to leave the keyboard and everything can be typed very quickly. This minimizes wrist strain (especially with mises) or finger-cramps-or-breakage (Escape-Meta-Alt-Control-Shift) in EMACS.
  • For those using pico, nano, consider yourself being taunted and envision yourself riding a bike with training wheels. Endeavor to be cool like the other kids.
  • You might have tried "vi" and had problems. Maybe the arrow keys were unsupported, maybe backspace was broken. You'll find vim is vastly superior to old-schoool vi. You still launch vim with "vi", but it's less broken. Scream in terror when you approach a SCO box and it has "vi" and not "vim". Consider upgrading however possible.
  • there are oodles of commands and options. You don't need to learn them all. insert mode will take you far, you don't need all of them -- especially when using vim (AIOCS).
  • There is no escape from beep mode. -- and merlyn, on my laptop, the infernal thing beeps using my PC speaker. -- you should treat beep mode as shock training. It's annoying you because you did something wrong, and it is encouraging you to type valid commands so you don't sound stupid in front of your other friends. Yep, beep mode is a good thing -- and it will make you faster through subconcious training
  • If you encounter any EMACS zealots while complaining about vi, they are there to convert you, so you should run away as fast as possible. Tell them EMACS would be for you if only you had twenty fingers. Or maybe "EMACS is a great operating system, but it really needs a good text editor".
  • run :h holy-grail when you get a chance and see the nine-billion options
  • Comment on Re: Learn vi/vim in 50 lines and 15 minutes

Replies are listed 'Best First'.
Re: Learn vi/vim in 50 lines and 15 minutes
by Abigail-II (Bishop) on Mar 04, 2004 at 17:43 UTC
    There is no escape from beep mode.
    Oh, sure there is. At least, on many vi-clones, and, IIRC, even on plain old vi. (But maybe not in vim).

    In my vi clone, it's as simple as :set noerrorbells, and that will turn off visual and audio bells.

    Abigail weren't supposed to tell them that. No, seriously, for newbies I think the bells are good instructional aids. I used to want them off, but they seem to be helping. I would only turn them if covertly coding in the bushes (say you are on a sting operation and have to take notes) and you don't want anyone to know where you are hiding.
        I've always find them annoying, and never, ever helpful. It hardly helps you in typing a wrong command, as almost any character is a valid command anyway. It's not that if you mistype a and hit s or z that you've hit a non-command. q is one of the few characters that's unclaimed (at least in standard vi, many clones have assigned a command to it - I've a command in my .rc file to disable it), but since it's unclaimed, it's tempting to :map it to something else.

        beep! usually means "the command you tried to give cannot be performed with the cursor in this situation", like not being able to go to the next line if you're on the last line anyway. But since nothing is happening (if something would happen, vi wouldn't beep), it's bloody obvious already that the command you intended to give isn't working.

        No, seriously, for newbies I think the bells are good instructional aids.
        Oh, get out of your ivory tower. I detest this degenerate attitude that newbies are morons and can't think for themselves. (That's a general pet peeve of mine, and not specific to you, or to vi). I really love that fact that a few hits on the return keys or the (back)space button bring my cursor down, left or right towards to margin. I really don't want vi to beep because I couldn't bother to count whether it was 3 or 4 lines. If I hit 4 times, I'm there, even if it was three lines. (Yes, I know shift-G brings me there, and ^ or 0 brings me to one of the left margins, and $ to the end - return and space, due to their large keys, are sometimes faster). I don't think it'll help newbies that vi beeps.


      Or do it in your terminal... I use xterms on Solaris (/usr/openwin/bin/xset -b)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://333942]
Discipulus yawns..
choroba yawns back

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-01-24 08:12 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.