Thursday, July 9, 2009

vi, Still Relevant

I thought this was a good summary of why vi (or more accurately vim) is still a good choice for editing today:

Why, oh WHY, do those #?@! nutheads use vi?

One trick I learned from this article that I hadn't known: keep the cursor on the same line, but position that line at the top, middle, or bottom of the script via 'zt', 'zz', and 'zb' respectively. I am always ending up with the cursor at the bottom of the screen while runnning macros, and I want to look ahead to the next N lines, but all the other movement commands like Ctrl-d, H/M/L, etc. actually move the cursor. zt is a fast way to tell how many more times you'll want to run the same macro, for macros that process the current line and then move down one.


Brian Tkatch said...

The oly thing i learnt about vi was ":q!". Then back to emacs. Luckily, i don't run into vi too often.

The power of a good editor is important to those who know how to use it. Be it vi, emacs, or whichever editor you prefer.

Laurent Schneider said...

As I do not use a clone of vi, your tricks with zt and zb are useless for me...

vi is the best editor in Unix why should I care installing vim?

What I do hate in vi :

Line too long and Terminal too wide error messages!

John Russell said...

Laurent: As I do not use a clone of vi...

There are many Linux systems where I don't intend to use a clone of vi, but still vim is hooked into the vi command. Maybe that's just Oracle's typical setup. I don't like some of the default behaviour on those systems -- colours on by default, live highlighting of search matches -- but it is fairly easy to put vim back into "visually matches vi" or "strict vi compatibility" modes from what I can tell.

When I'm using OS X terminal windows, full-screen on 24-inch monitor, vim doesn't complain about the width. I do experience odd cursor-off-by-1-line errors with some combinations of ssh clients and Linux systems, both with vi and vim.

John Russell said...

Laurent: vi is the best editor in Unix why should I care installing vim?

Record and playback of keystrokes as macros. I often prefer this technique to automate search/replace/delete/rearrange operations over a series of files, even over a 'perl -e ...' one-liner.

spkv9xz9 said...

I am Amane Matsumoto. I am from Japan.
I am makie-shi (Japanese lacquer artist) and shoka(Japanese calligrapher).
I have spent my life working on traditional Japanese lacquer(urushi).
I am the Kyoto style artist and I have samurai soul.
I can make samurai maetate of Japanese helmets ,inro ,saya of Japanese sword ,gold Japanese lacquer boxes and so on.I have the highest skill in Japan.

Japanese lacquer art is made with gold ,silver ,platinum and so on.
The subjects I pick are very often nature.

I admire Mr.Lawrence Joseph Ellison in every way.
I am very happy that he research and learn
about Japanese culture and arts like Zen.I think he is a true samurai.

I'd like to ask him to become my patron.
He must have been extra busy , but if he would not mind helping me get through this tough competition, that would be tremendously appreciated.
I sent my work(sho) and the photograph of my work(urushi)to Oracle head office. But I hardly ever get back his reply.
It may be that he doesn't get my photos and works.

Could you help me?
I'm at a loss. But I can not want to give up.
I would like to contact him.
I would like to go to America to meet him.
I'd like to ask him to become my patron.
I wish I could contact him somehow or other.
Could you help me? My Email Address is .

Thank you so much for your kind reply.