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.
Thursday, July 9, 2009
Subscribe to:
Post Comments (Atom)
4 comments:
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.
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!
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.
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.
Post a Comment