Saturday, December 29, 2007

Why vi: The programmers' true editor

--- Update Thu 01/21/2016 ---
I have been getting quite a few (actually a lot of) hits on this 9-yr old post. The post that linked it didn't do it in the right spirit, the author, she clearly didn't read the post even a little bit and blindly linked it to her blog going only by the URL! So I want to clear the air for my readers here. Just so you don't continue reading with the wrong mindset of:
"This Shaolin a__hole thinks he's a great programmer because he uses ancient vim; and he thinks whoever doesn't, is a loser!"
Rather, really the one and only intent of this post is to put you in the mind-frame of
"Let me read why vi is a really great editor & why it's worth learning vi!"
If you continue with the intended motive of this post, you will have learned something about an editor you don't often hear much about anymore.
--- End Update ---
This is one of the topics I promised to post on... why *every* true programmer must use vim!
Note: hereafter, I'll use vi and vim interchangeably, and mention of one should implicitly mean the other as well. Additionally, when I say vi, I usually exclude the more exotic variants and derivatives of vi. Also, this post is more about conceptual consistency rather than technical accuracy.
All this is out of my personal experience and taste for things that are simple, elegant, and yet powerful and usable. Besides, I would say that you have to be completely insane and out of your senses should you ever use any editor on Unix systems other than vi and emacs (and sam).

This post is _not_ for people who:
  • are not serious programmers
  • are not touch-typists
  • hate the world of pure-n-plain text
  • don't have to type much in their lives
  • last but not least hate length, get off the post if you are not in a mood to read lengthy stuff
In contrast, this post _is_ for the people who:
  • are serious about programming
  • are Unix nerds or are budding unix nerds
  • care about being efficient
  • want to improve their efficiency at programming
  • want to make vi way of their lives!
After using vi only for about a decade I have come to believe that vi makes any other editor (if you will call them editors at all!) like kindergarten toys!
It's not mere editor, vi, for me, is the way of life. It is one helluva piece of program that I look up to whenever I have to design something for usability, reliability and efficiency.

It's just like the old AK-47, simple, effective and even after decades of invention and superseded by million other advanced rifles, it remains the indisputable favorite weapon of assault!

For the morbidly interested, I guess it's fun to see how and why I myself started using vim.
I started using vim in late 90's, 1999, maybe. Back then, I used to idealize on an extravagantly hyped and sought after personality. Used emacs back then, because so did my morbid ideal. Then, I started reading books by the revered Richard Stevens (for the benefit of others, even after passing away from this sickened planet on 1st Sept 1999, he remains the undisputed BEST author of number of unix books, for beginners and advanced users alike. UNP, APUE, TCP/IP...).
Or maybe it was some other of my favorite books, I don't recall. Somewhere in the forewords or intros, I read that the book was completely written in vi and typeset using troff/TeX. That was the turning point in my life... for I haven't looked back ever since! Screw emacs (I wasn't loving it anyways, was kinda forced to use it for my desire to mimic some morbid people back then!). It was a little cumbersome (undoubtedly, far less cumbersome than emacs) but I knew I would do it! And I indeed did it! And so can you.

For those who don't have a clue what is vi, simply put, vi is a program that lets us the mortal programmers (not coders!) edit files on a computer, not only to write exotic and fancy obscure programs, but also lovely, lucid and romantic love letters ;-)

The first time you type vi on the shell and wait for the magic to begin... you are greatly disgusted! Holy sh_t! Where did all the 'File, Edit, ...' menus go??? All you get is a simple welcome banner and black background. What is this, some kind of charity soliciting freeware or something.
No toolbar, nothing. And people rave about this little beast! You have to hit 'i' to enter any damn text. Remember what mode are you in (normal, edit, ex), lest you end up deleting every line around. Apparently brain-dead hjkl cursor movement keys. What kind of contrived mind on earth would devise such a thing :( But use it a couple of times, and I bet you won't want to go back, EVER!

Here I've tried to put up some of the reasons why I chose to stick to vim, and would do so for the rest of my life.

0. Ubiquity
Some people, if not for anything else, use vi, only because it is ubiquitously available on any of the damn stock Unix installations! It has got a very small foot print and hence making it a part of standard installation package is perfectly natural. (And it's available for non-Unix OS'es as well).
Thus, learning just one editor ensures that you can edit files on any system in the world. Versatility, is one quality that won't hurt programmers! And a must for system administrators! I'm yet to see a sys admin who doesn't use vi!


Apparently dumb hjkl keys for cursor movements is simply *the* best invention of vi. Here's another background story...

Back when I worked at IBM, I had to work with all the exotic varieties of Unix: IBM's AIX, HP-UX, Sun Solaris, and tens of Linux distros. On many of these systems, it was impossible to use the regular arrow cursor keys to navigate, in file, as well as on shells (which apparently has to do with incorrect terminal settings, which no one ever got around fixing). Re-typing the whole 101 char command, just because you put a comma (,) instead of a dot (.) was simply maddening. It was painful, until my then Team Lead, Magesh, told me that there's really a nice way around it, 'vi editing' mode in shell. He said it's not very comfortable, but works. I said: what in God's name are you talking! Not very comfortable? !@#$ That's the next best thing to have happened to mankind since the invention of wheel and vi!
$ set -o vi
in your bash and now you have
most of vi's cursor movement and text manipulation commands at your disposal.
So much so, even GDB supports
vi-readline mode! See, I wasn't kidding about ubiquity, vi is everywhere.1. Simplicity
Really! There are only a very few basic commands and concepts that you need to master and you can navigate and edit files at lightning speeds. I hardly know a fraction of vi commands (but know them pretty well) and people grasp in awe when I edit files (I'm not posting this in self-appraisal mood, but just wanna illustrate that it indeed is impressive to see people using keyboard efficiently). Just for you to know, my love and passion for Unix and vi (second not even to martial arts) are notoriously legendary amongst my buddies and colleagues. They just don't ever get me started on either, but here you have no choice ;-)

Cut/Copy/Paste, edit, replace, search, sort, increment/decrement octal/decimal/hex numbers, number the lines, compare files, navigate directory tree, work with multiple files, encrypt/decrypt, transpose, anything, literally anything... you can do all this with stunning speeds, most of them at the touch of 2-3 keystrokes! If you can think of it, you can do it in vi.
Note: Though, some of the features are only available if you have a usable shell.

2. Speed
What some people consider as arcane hjkl cursor movement keys, I say they are just awesome. Once you get used to them, you never have to take your hands off the keyboard to move up and down the lines. And it makes a hell lot of difference in how effective you are at editing. Besides, it makes you look really cool and geeky ;-) you know... just in case you need to impress that lesser known girl sitting across your cubicle, when she just sneaks upon to checkout what are you up to! Some people argue that one spends more time thinking than at keyboard writing programs. This is not entirely true, you spend a hell lot MORE time going through, typing, editing and re-editing and modifying your code than you think you do or would do. Which means, increased efficiency and speed of doing all that would directly improve your effective throughput. Plus, it would help you keep your mind on task at hand: which most certainly will be programming or chasing that unintelligible lines of code.

3. Extensible
There are a million extensions out there to make you feel at home with vi. You most certainly don't have to use'em all. Try and stick to a few that you find good and easy to use. I personally use only a handful few, notably: buffer explorer, winmanager, CVS, and draw it.

4. Powerful
Now, if you happen to ask me why on earth would I need to sed ever, then please, vi is not for you. You are better off with medit, notepad kind of brain-dead editors. There are times, when you want to do magical text replacement, deletion and addition, modification on file of hundreds and thousands of lines, not necessarily source code, but maybe logs.

You want to number all the lines in your file, or remove them, sort numbers and rearrange them, sort text, filter them, swap the arguments in all the function calls, or even record keystrokes so that you can replay them a million times to repeat your last set of actions... you can do it in vi, with just a command or two! (If you are gaping in surprise as to who on earth would want to do all this sh_t anyway! That is, if you are one of those lesser beings who never had to do anything of this sort, you are not a true programmer. And vi is not for you). Another feature is selecting columns of texts, rather than rows the more traditional (dumb ass) editors restrict you to. Which means, you can select vertically, rather than horizontally! Of course, the degree and frequency with which you have to do these might vary, I have to do it all the time, and there's not a vi command that I have learnt and haven't used! Remember, I still don't know more than a handful of them.

5. Learning Curve
Learning vi can be a daunting task, but if you are going to be editing (viz. programming) 10+ hrs a day, for most part of your living life... then I see it as the second best investment you can make in yourself, first being learning touch typing (which I have been assuming all the while you know!). If you don't know that, then don't even bother learning vi, for you would degrade your experience to nothing but hitting mindless keystrokes, and frustrating the hell out of yourself.

vi commands are incredibly powerful for text editing, and you can even combine them to obtain the best results. While typing some text, it is a regular keyboard, but when you're back to normal mode you have the best-designed text-editing contraption there is.

Here's the nice little jpeg, that I got hold of by someone, which compares the learning curves:
If you guys think this is way too much, or all of this is BS... I haven't even talked and touched on exotic features, custom syntax-highlighting, searching, tags, file operations, color schemes, extending vi, etc.

This post is just tip of the iceberg of what vi has to offer.
You take the vi pill and you stay in Wonderland and I'll show you how deep the rabbit-hole goes.
There's lot I can go rattling about, but in the interest of brevity (???) of the post, I think it's time to let you guys off by yourselves.

But beware, if you at all get proficient at using vi, you will reach point of frustration... not with vi, but with people NOT using vi! For you won't be able to tolerate your colleagues taking for ever to point their pesky little mice to the 'Tools' menu, hit the 'Go to line' option, put in a number, hit enter and then grasp at keyboard to reach the desired word! Just to learn they entered the wrong line, starting the ordeal all over again! You would just feel like grabbing that little mouse and shoving.... well, no offense intended buddies.

I personally believe in relying on a few trusted and tried tools to get the work done, rather than to use anything that's available.
Mine are: vi, C, bash, sed, awk, perl, binutils, coreutils.
If I'm to work on a system for more than few hours, I request the owner to let me set up my arsenal, personal settings of which (viz. .vimrc) I always keep handy.

For people, who got even slightly motivated to learn this new way of life, I'm going to post an small tutorial soon, with tips on how to effectively use them. But you don't have to wait, there a zillion out there already, just google'em out and begin TODAY!

Try it out for a week or two, editing everything you want to in vi, even for smallest of things. And if you don't like it, I recommend stop chasing the elusive dream of learning vi. Since most of you use graphical interfaces of any OS, start with gvim, the Graphical VIM. Plus, editor in your favorite IDE might already support vi-emulation, RTFM to dig it out.


Interesting links:

  1. vi was, supposedly, originally written by Bill Joy
  2. vi[m] homepage for anything and everything
  3. There's more about why we !@#$ nutheads use vi[m]!
  4. Graphical tutorial, Not the best out there, and probably a little too overwhelming for beginners, yet I share it.
  5. Why emacs is not that great an editor
And BTW, here's heart felt wishes to all my readers

Wish you all a Very Happy And Prosperous New Year 2008.

Tuesday, December 25, 2007

Visit to Pittsburgh Zoo

This was my and Vish's *very first* visit to any decent place outside CMUniverse and our den. Ever since we have been wanting to visit the Pittsburgh Zoo and PPG Aquarium.

When our grand plans to visit New Jersey went down the drains, we became even MORE desperate to tread outside. Zoo was the perfect choice, since we all love animals (for the time being, lets keep aside the argument: If you love animals so much, how come you like to see them in captivity!). So the usual trio, myself, Raju ki maa (aka Moti... err Ritu) and Raju (aka Vishal) all set out early morning for the zoo!

The Trio: Ready for some kicka$$ adventure in the rains!

First step outside the apartment and my reaction was: #@$! WTF!!! It's raining! Why the !@$# we didn't see the weather forecast (which, btw, unlike India, is pretty accurate here in States!) and plan the day :( Damn! The only plan to go to a decent place is gonna be screwed. Heavy hearted, opening our umbrellas we all tread along, just in the hopes that rain will soon stop by the time we reached the bus stop. Alas! We were wrong, and I recommended going back home, since it would be waste of time and money to visit zoo in this weather. As most of the enclosures are open to sky, I argued no animal would want to drench in this nasty rain. Vish & Ritu insisted we stick to the plan.

Still raining, we reached the Zoo, paid the entry fee ($8) and I asked the guy if there was even slightest chance we could glimpse even half of the animals advertised on their website. He gleefully said 'Most Certainly, Sir'! Still skeptical, we moved on, silently cursing ourselves for just throwing $$$s and time down the drain. We certainly should be crazy to do this... Looking at the map, we strode inside the zoo...


A way into the wilderness...

Lo and behold! Good Lord! Was my first reaction... and all the gloominess sublimed in thick moist air! It was raining, unwieldily maneuvering our umbrellas and cameras, we tried to capture the a really really huge tiger, into our virtual world of digital photography. But wait, he refused to go away... Blissfully playing and rolling around (videos to come soon, once I edit out noise and put a real cool NatGeo-like music in!). Wow! We all smiled at each other, this is gonna be freaking awesome! Thanks to Vish and Moti, rain, after all, wasn't a deterrent for these mighty beasts! The zoo, I should take a moment to say, is REALLY amazing!
I believe the $8 fee is way too little for the quality of zoo this is! It's so well maintained, and all the animals, seem, to have been taken care of pretty well.

3 wild-n-mighty beasts in one single frame!

3 Cheers for the tiger!

Kings of the kings: rather listless today :(
(probably the 2 had a fight last night over what channel to watch!)

Then came a VERY huge artificially created Tropical Rain Forest enclosure, where there were a variety of monkeys. The place is meticulously controlled for it's resemblance to actual rain forest: the light, humidity, ambiance, temperature, etc. Pretty impressive. Outside, while having hot (but absolutely tasteless) burger, we could watch this huge bear:

Kodiak bear (from Grizzly bear family) trying the strength of his mighty teeth on the log!

The indoor aquarium was just breath taking! You name a fish, tiny, small, big, huge, really really huge, anything, and it was here!
Someday, I'll have a this waterfall and aquarium kind of arrangement in my house too!
Waterfall and the fish aquarium

Beautiful Emperor Angel Fish

This fish is REALLY BIG!

Straight out of a fairy-tale book: Sea Dragon

Another beautiful indoor aquarium.


Touching the sting ray and small shark!!!

Family reunion :-P

Suse Linux!!!

But *the* best part was seeing Polar Bear playing with a rubber ball! It is one of the most spectacular wildlife moments I've seen! Now, as you can see, the zoo is REALLY very well architect'ed: you could see these polar bears from top, kinda bird's eye view, or through a glass enclosure, where water level reaches your knee, or from an underground glass tunnel, which is MOST exciting of the views! You can so closely see the Bear's graceful movements that you will be mesmerized, just like us. We spent good part of 45 minutes just observing the bear!
Here's a video:




Here are more videos for you to watch: Pitt Zoo Videos. Plus, Vish has uploaded the whole album on Picasa, a good 325 photos from his and my cameras. I'll do it soon too. Meanwhile have a look at the pictures and videos Vish has uploaded.

Maa, we are tired, ready to go back home!

Oh, and yes, Wish you all a Very Merry Christmas and New Year!

Links:

0. Complete Album
1. Few of our videos
2. Pittsburgh Zoo Videos

Wednesday, December 19, 2007

Done with exams!

Back after a long hiatus. The grueling final exams of the Fall '07 had kept me off blogging. The semester wasn't bad, and I'm satisfied with it, though, there are things I would be improving on the upcoming semester, which is what I'll use the whole of winter vacation for. This vacation we (as in me and my roomie, Vish, aka Jay) intend to slog harder than we did through the semesters to achieve the mammoth goals we have set for 3-4 weeks!

It has started snowing here, a couple of weeks back, actually. And I find it very exciting because this is the first time I'm seeing snowfall!!! It looks beautiful around, everything is just white, PURE WHITE! No adulteration! But it's not easy to survive in snow, once outdoors, you gotta be careful to be well equipped: thermals, weather-proof jacket, good shoes (if not snow shoes), nice head-cap, muffler, etc. The wind chills are the worst part, sub-zero winds blowing at tens of kms/hr are not easy to bear. And just 2 days back I had been to Robinson Mall's Walmart, and the wind actually strayed us away from our paths while we were walking on the highway!!!

Here are some photos, see end of the post for complete albums.


This is CMU's legendary ECE department, aka Hammerschlag Hall.



Lying down for a short nap...
Naah... it's pretty cool down and you bet don't you stay any longer than a few moments, lest it freezes your nice little butt into a hard rock.

Once lush green lawns of CMU are now all snow-clad, no trace of green colour anywhere!!!
Cute snowman that some beautiful girls made (wish they too were in the photo :-P )


Thanks to thermals, Vish's attempts to freeze his a$$ is foiled!

Snow everywhere!
This is how parkway looks like after snowfall through whole night. Taken from Namrata's house.

Brave boy!
Only the braves dare tread in such heavy snow and lethal wind chills...
On our way back home, after we went grocery shopping at Walmart the previous day, that's what's in that HUGE ruck-sack.

Raju ki maa (scolding): Badmash Raju, drinking wine?? Aaa???

Apart from these, writing my own shell, exploiting buffers to open an interactive shell on remote system, developing small yet completely functional proxy server, and a zillion other projects kept me busy through the post-midterm part of the semester.

What I promise my readers this winter break are:
0. vim: a beginer's guide
Only because, I believe true programmers use ONLY vi[m]
1. Why vim?
Why I believe 0 is so true
2. New and revamped homepage
3. Why simplicity rocks: in light of Unix design

As I promised, and as usual if you have read so far, then you deserve to get bored a bit more... here are some albums that Vish has put up:
0. Snow in Pittsburgh
1. More Snow in Pittsburgh

Photo credits: Vish

Saturday, October 27, 2007

Rafisab moves me again!

Mohd. Rafi, a singer of caliber so high, nature so humble-n-humane that there NEVER was and NEVER will be a singer close to his abilities, PERIOD! He moves me once again with his Godly voice. Listen to one of his amazing hits:
Title : Tu Hi Woh Haseen Hai
Movie : Khwaab
Singer: who else, Mohammad Rafi
Album : Legends - Mohammad Rafi - The Virtuoso

These are NOT authoritative lyrics, but the best you can get, my own run time translation, because there aren't any on the web :( But... check out the link at the end of this post!

Tu hi woh haseen hai
Tu hi woh haseen hai
Jiski tasveer khayalon mein muddat se bani hai...
Tu hi woh haseen hai
Ooo hoo Tu hi woh haseen hai

Rukay roshan pe zulfay bikhrai hua
Jisay chanda pe badal ho chaye hua...
Meinay dekha tujhe to mera dil mujhe yeahi khene laga
Ooo ... meinay dekha tujhe to mera dil mujhe yeahi khene laga
Dhunday nazarae jisay din raat koi aur nahi hai
Tu hi woh haseen hai
Ooo hoo Tu hi woh haseen hai

Wow, the way lyricist has alluded to his amazingly beautiful lover, Rafi adds his enchanting, innocent, adorable, pure voice personifying the song! Evoking strong emotions of almost insurmountable magnitude. If you LOVE romantic songs, don't shun away from this song, but yes, as usual, you GOT TO listen it with a calm mind, with 110% attention to the song!

As promised to save you time and energy of searching the song, if you reached this far, then you deserve a direct link to the MP3.
Yes, if you are Rafi lover, I can try to up the series 'Legends - Mohammad Rafi - The Virtuoso'. But I bet there are already a zillion out there.

My buddy's blog

All you technophiles out there, my chaddi-buddy, my darling friend, my alter-ego one of my closest friends over a decade (touchwood) is into blogging now! Presenting you: Arun (aka Anna! Beware only I can call him Anna, you guys should resort to back to plain Arun!)

He promises some great things in his 'Hello World' post, so Anna, we all are looking up to your blog! And I know you will live up to our expectations!

And you guys... don't ditch visiting my blog :-D

Note: Well, he didn't say this, but I trust my blog inspired him to start one of his own ;)

Monday, October 22, 2007

Beautiful Autumn

Season of beautiful vibrant colours... just outside the main campus...


Photo Credits: Self
Equipment:
Sony W700i

In search of a perfect haircut

Cool Dudes, before they went on the quest for the perfect haircut...Much frustrated as they were with long hair and done with midterms, they wanted to feel light... relieved of _some_ burden... haircut was the salvage, or at least so they thought! Off they went hunting for the cheapest place to get the cut. Average rate is about $15 (plus $1 compulsory tip!) which is about $16 * 40 == 640/- INR!!! (Naah, I can't stop converting $$$s to INRs... and probably won't until I start earning some $$s).
WTF! Back home that is way beyond my yearly expense on grooming, even if I had a decent head massage after every cut, every once a month!!! After much hunting and calling places, we found a place which we suspected might be a tad cheaper. But to our dismay, it was shut. Damn! Businesses here shut down by 1601 hrs :(

Next day we came and voila! We walked in, $13 (+$1 tip)... savings of $2! Not bad, after all it was worth waiting! We had decided to have the shortest cut possible, only second to full moon!
Crew cut, was what these dudes settled for! And the result is in front of you:

Back in India, I bet all you buddies there are laughing your a$$e$ off at this, but no regrets! The cut makes me feel so light headed :D
Photo Credits: Atul/Vish
Equipment: Sony W700i

Sunday, October 21, 2007

Screenshot, weekend update and more

Just done with midterms, and took a 2 day break from 16-hours-slogging-per-day regime. Seeing recent posts people have started believing that I'm having a gala out here. Indeed I'm having a gala time, but not of the kind apparent from my recent posts. The 16 hour regime is a norm here at CMU for every grad student. With weekends requiring a little more than 16 hrs! Schedule's packed with inceasent stream of assignments, projects, quizzes, tests and lectures. On top of that, household chores, cooking and everything else! But yes, I'm enjoying it :) I *have* to enjoy it!

In midst of all this, I keep fiddling with my box, which I LOVE doing, and just managed screw up my Lightning Calendar today :( Lost all the important appointments (read dates) recorded in there.

I use Thunderbird (hereafter refered to as thunder) as my mail client, and it has this amazing calendar plugin: Lightning. On my Debian lenny/sid, thunder was stuck on 1.5.x version. I wanted the latest one, 2.0.0.6, and so tweaked the /etc/apt/sources.lst file to include 'unstable' packages. 'apt-get update' followed by upgrade of thunder rendered my thunderbird useless :( Going back to older version doesn't work (at least not trivially) and latest version erased all my calendar appoitments. And as you can guess, I DIDN'T have a backup of my calendars :( To worsen the matters, the Lightning refuses to work with Thunder now :( Oh, and I forgot to tell, the reason I wanted to upgrade was that the Provider for Google Calendar works only with the latest versions.

So, I've resorted back to Sunbird, a standalone calendar/organizer. Haven't got it organized it yet, because the fonts are looking unweildly BIG :( And there's absolutely no control over it from the preferences and neither from 'kcontrol -> Appearance & Themes -> Fonts' Gosh, today is the day to screw up apps, I guess!

And I'm aware that there haven't been any screenshots recently, but remember that I never stop collecting s___y wallpapers! So here you go... only this time a little digression from my regular type of snapshots...

The sexy widgets that you see (system info, time, KDE version) is SuperKaramba! Let me know if you are curious what themes are running, too lazy to detail on that now. I've persnalized version of them to fit my needs. And here's the link to original wallpaper.

Saturday, September 29, 2007

EGO Fall 2007 PIcnic at CMU

After 2 gruelling months, finally we got a small opportunity to unwind a bit, the EGO Fall 2007 Picnic, at Scheneley Park. After a LONG LONG time me and Vish set out of apartment with a relaxed mind, despite loads of work and assigments to do.


Taming the Lion. photo credits: Vish, concept: Atul

We had vouched to enjoy at the picnic to the fullest... and guess what... we DID! We Just Did It! Strolling along the park, clicking loads of photos on the way, we reached the spot: satisfied our taste buds with Indian food silenced the bubbling juices in our grumbling stomaches ~~~tears of happiness in eyes~~~ played with flying-dish, soccer, the swing, relaxed a bit and then headed back to our den.


Here you go, check out the albums:
[1] Prince's album
[2] Vish's album

Wednesday, September 26, 2007

Choosing a Laptop/Notebook

As promised earlier, here you go with this post...
I have spent endless hours reading posts after posts, reviews after reviews for more than 3 months before deciding the exact config and model. Like me, if you don't have unlimited money resource to buy a laptop, you would want to be maximize your value for money! Thought this small guide might help you a bit towards that end. Feel free to add and seek advice :D

0. Processor
Most of tasks we do are not CPU-bound, they are IO-bound. So invest wisely
Anything more than 1.86 GHz is just a feel-good-factor! If you are not into too much of graphics (which is the case for most of us), trust me, processor is NEVER the deciding factor in the over all feel of speed you get. So don't waste your $$$s on this, no matter what GHz shit Intel promotes. In fact, if you are observant, Intel just stopped pushing GHzs these days, in fact from P-4, they started NOT advertising speed much and even reduced their core clock speeds!!! And if you missed that, take a note NOW!

But yes, don't go for the outdated Celeron processors. Dual core, in my view is NO better either. You are better off with single core Pentium-M, and if you saving some bucks, go for single core. Ask the sales rep explicitly if they offer discounts on single cores. And don't even think of Quad-cores for your notebook! Whoever tells you need one, is full of sh!t!

1. RAM
1GB is great, but 512MB is not bad either. Get 533 MHz DDR2, that's the standard these days anyway. If you gonna run vmware, or any other virtualization stuff, 512MB might be a tad too little. And anything above 1.5GB, again, is a WASTE! It like 1 person living in Palatial house! You definitely feel good, but don't need and never gonna use that much space!
(update: I don't use M$ OS much, so thanks for update from my colleague, Vinay. He says you need 2GB for Vista! God! My Linux runs pretty darn well on 512!)

2. HDD
Hitachi is really good. Never made it's presence felt by emitting unnecessary decibels. What is VERY important is that buy the fastest you can in your budget. Even if it means cutting down on few GBs of space and compromising RAM!!! Being a mechanical device, it's the slowest element introducing the maximum latency. That's the reason I opted for 512MB RAM and 80GB 7200 rpm HDD. I could have very well gotten 1GB RAM and 120GB 5400 rpm HDD n the same cost. But just increasing RAM doesn't increase the speed. I can bet my config will kick a$$ of the later config! So, invest wisely. Remember what I told above, most of your tasks will be IO-bound and NOT CPU-bound.

3. Display & Resolution
That's purely a matter of choice. Too small a display (12") means cramped kbd, lesser screen real estate and limited resolution. Too big a display (17") and you are better off leaving your baby on the desk. For me 14" worked the best. Small enough to carry her around. And still full sized keyboard. Read the spec for pitch and keystroke. Highest in the class resolution of 1400 x 1050 gives me more than sufficient screen real estate.
There's another thing, depending on your taste, you might want a glossy vs matte finished display. I personally like matte, it reduces the glare and looks more professional. I don't know of any maker giving you matte finished screens other than TP.

4. Weight
You don't have much of a choice here, because this is dominated largely by the size of your lappy. Your call, what takes the precedence: weight or size.

5. Built
TPs are notoriously famous for lasting years immemorable! Nothing beats it! But I tell you, Sony Vaio looks more sexier. It's Classy vs Sexy. Vaio will get you more stares from babes than TP! But hey, TP also has a legend, which goes like: If you enter a boardroom, and don't know who's heading it, look for ThinkPad! I tell you, it's classy jet-black looks are superlatively beautiful.

6. DVD
Due to her size and built, my TP could only take 9mm drives. To my knowledge there's only one maker of DVD-writer of that spec: Matshita. I WANTED a DVD-writer and had to spend a fortune getting it! Probably you won't have to take that pain. Go for the best you can here. And yes, if you are in a habit of backing up your movie DVDs a lot, you might wanna consider buying a DVD drive which has a firmware update to ... you know what!

7. WiFi
Get the built-in one, don't buy external card, it's cumbersome. I trust most of then have built-in, but if you go for 12" (or lower) sized notebooks, you will mostly probably be left with no choice but carry that additional card with antenna sticking out of it. This does give your notebook a robotic look, but don't forget that it gets tangled in wires VERY easily if you move around a lot.

8. Mobo
Unlike PCs, you don't have much say here, you gotta take what the maker gives you.

9. Heat
You don't want to boil eggs on your notebook, you are better off with your traditional stove. So another most important factor that you wanna consider is how good is your notebook's thermodynamics. Because more the heat means faster fan. And yes, the faster your CPU higher is your core clock and more is the heat generated. This is another good reason to not reach for the fastest processor. And faster fan implies more noise and shorter battery life. Only way to figure this info is to dive in LOTS of mailing lists.

Same config on Dell, HP or Acer will definitely cost you 30%-40% less! But I tell you, if you are looking at notebook for longer run, it's worth investing in ThinkPad. DON'T buy TP from India, it's hellishly expensive there! Plus, you won't get all the options to configure. If you can, buy it from US or Canada.

What I've never tried with my TP is the S-video port, PCMCIA slot. Things that she doesn't have are FireWire port & card reader. I don't need'em.

If you are serious on buying a TP, I strongly recommend that you spend some time on ThinkPad Forum. It's moderated by some GREAT moderators who are freaking knowledgeable about TPs and have ripped many of them apart and put'em back, SUCCESSFULLY!

Acronyms used:
TP: ThinkPad
kbd: KeyBoarD
mobo: MOtherBOard

P.S.: These specs and tips are not of much use to you if you are one of these species: Gamer, heavy video-editing, number-cruncher, etc. where CPU power becomes too critical a factor. But the general guideline will still help you. And neither have I taken Apple Macs into consideration.