Saturday, May 5, 2007

Why vi?

"Why vi?"

Though it was probably the hundredth time I was hearing it, I was startled to hear that Q! We were trying to make a release and this question was asked by a colleague of mine who apparently got frustrated after trying to use VI for editing an ant build script.

I started answering as if I am the final word on the subject. I started like this.

During the dawn, there was no kwrite. There were only line editors such as ex and ed. When VI came, it incorporated the commands of ed. So, VI could relate to dawn and the people from the dawn.

"So what if a small set of geeks know how to use it?"

Hmm... I can't let him win this fast....

They were not just the geeks. They includes the lot of developers and sys-admins of Unix/Linux world. The simple proof for this is the fact that for many programs such as editing crontab etc the default editor is vi. In fact, the only time when I used another editor was while using pine. vi is omnipresent. You can find it on almost any Linux system.

"But, it is difficult to know when you can enter the text and when a command"

kid... doesn't know to use vi...

It is very simple. You just have to keep seeing the last line and the status will be shown there. insert, replace, visual... Or if it is blank, it is in command mode. In fact, once you get familiar with vi, the mode flags will be changed in your mind and hand and not just on the editor. You won't even have to see the last line.

"But, its still very difficult"

Lot many buts... its time to kick his butt...

Unix is as an OS for academia & Linux started the same way. In the dawn, the people who used it were a new species derived from the existing homo sapiens who possessed a special organ called brain. This organ enabled them to comprehend usage of simple tools such as vi. Later, when the above tool was made popular by those evolved humans & progress of life started to depend on that, others were forced to use the same. The only advice that can be given to the un-evolved onces are, "we were like you once... try for a while... you too will mostly evolve in another 2.6 M seconds"

I concluded by saying this.

Years back, vi used to have such properties which are the key features of many flashy IDEs of this day. Syntax highlightening, Source browsing (using ctags), multiple window, simple but highly effective crash recovery, multiple windows, key word completion... list goes on and on.

Our institute mainframe had many tutorials in it. One of them was on ex. After learning ex, next year when we got our accounts in department labs, I started using vi. Since I knew ex, it was very smooth. And, I personally feel that people should be first taught ex before giving them access to vi.