A Conversation for VI Text Editor

Vi good, not vi = bad.

Post 1

Caveman, Evil Unix Sysadmin, betting shop operative, and SuDoku addict (Its an odd mix, but someone has to do it)

Being a mad unix hacker, I use vi.

Working for a company that writes software for windows, I have to use windows. Consequently, I write C code with vi, using a DOS version of vi. That version is a little crippled by the lack of some of the more useful commands (such as !! (pipe a line or group of lines through an external command))

What irritates me most is that ESC-Z-Z doesn't get me out of EDIT, Notepad, etc. When you've spent a lifetime using vi, from the early days of the Olivetti 3B2, up to very nice implementations of vi on Linux (vim, elvis etc.), it's sometimes hard not to commit 'vi-isms' in other editors.

Once recent development is 'Vigor'; spawned by some genial evildoers; possibly started by Pitr of the User Friendly staff, who of course uses vi. http://www.userfriendly.org/cartoons/archives/98nov/19981117.html

Vigor is an extension to vi that emulates that stupifyingly annoying dancing paperclip (well, sort of) in MS-Word. Details at http://www.red-bean.com/~joelh/vigor/


Vi good, not vi = bad.

Post 2

Administrator-General (5+0+9)*3+0

Being a not so mad UNIX hacker, I use "textedit" or the like.

But I still fall back on "vi", when the "textedit" program refuses to admit that I've changed user IDs before opening the file, and therefore refuses to save the file because it's not really mine.

I also use "vi" sometimes, when "textedit" isn't in the current user's path. "vi" always is.

I'd have been happy to forget everything I know about "vi" ten years ago. The trouble is, it's still a useful survival skill. Kind of like DOS.


Vi good, not vi = bad.

Post 3

manolan


shouldn't that be SHIFT-Z-Z? Always use :q, :wq or :x myself.


Vi good, not vi = bad.

Post 4

Caveman, Evil Unix Sysadmin, betting shop operative, and SuDoku addict (Its an odd mix, but someone has to do it)

The ESC was for the benefit of those folks who can't remember if they are in command or insert mode at the time. Shift yes, but I typed capital Z's in there, and sort of expected people to know the difference between Z and z. All these windows users with their non-case-sensitive filenames don't know what they're missing. (And they insist on putting spaces in filenames too.. Ugh. Our 'web designer' doesn't seem to care that img src="foo bar.gif" doesn't work as intended with Netscape. His answer was 'use Microsoft internet explorer', which is not an answer. I could rant about this for days, but you're in luck because I'm going to stop now.

I think I'll create an enormous file called "-rf" "*" in his directory and see if he can delete it correctly......



Vi good, not vi = bad.

Post 5

manolan


One of our admin types forgot he was logged in as root one day and typed "rm -rf *". Only when it didn't come back immediately did he realise exactly what he'd done. Dev server, fortunately!


Vi good, not vi = bad.

Post 6

Caveman, Evil Unix Sysadmin, betting shop operative, and SuDoku addict (Its an odd mix, but someone has to do it)

I've done it deliberately once just to see how far it got before it went boom.

Having seen the results of many a user's experience with the rm command, it's easy to see why people want a safe rm, or an undelete. However, as a sysadmin, I detest those inexperienced people who proclaim that even root shall have this 'improved' rm as default.

Root is dangerous, it should be, and that's precisely why most sysadmins who know what they are doing (a declining breed) don't sit logged in as root all day.



God, Root, what is difference - Pitr, User Friendly.
http://www.userfriendly.org


Vi good, not vi = bad.

Post 7

Gone again

I've hacked with MSDOS, Windows and VMS. I've even done it with Unix when I had to. :-o I have found vi to be powerful and capable, with the most unfriendly, user-hostile interface I've ever encountered. smiley - sadface

When you have finally learned the (deliberately?) non-intuitive EX incantations, you can make it do almost anything. Having devoted all that effort (and it is a *lot* of effort), you then forget how hard it was, and pooh-pooh the moans of people like me with excuses such as: "Of course it's complicated, it's because it's so powerful." No. Equally powerful text editors are less complicated and more frendly.

The description by the OP (the original writer of vi, IIRC) makes it sound fluffy and cuddly, and suitable for newbies. It isn't. There are alternatives that are easier and more intuitive to use. Sadly, few of them are available for as many platforms as vi now is.

In summary: super-powerful; venomously user-hostile.


Vi good, not vi = bad.

Post 8

Vandervecken

I sympathise with the C-coding thing. I have VIM on my Windows NT machine at work, and I write C code for an AS/400. I have found the AS/400's SEU editor so intensely annoying, that rather than actually use it (for large pieces of coding, at least), I would far rather ftp all the files down to my PC, edit them with VIM, and the ftp the whole lot back again. Says a lot!


Vi good, not vi = bad.

Post 9

manolan


Sorry, Pattern-chaser, gotta disagree. The basic vi interface, although not exactly intuitive, takes only a few minutes to learn. Even some of the more advanced ex commands only take a few more minutes and if you're really stuck, there's always the O'Reilly quick reference guide to stick up on the wall.


Vi good, not vi = bad.

Post 10

Uncle Ghengis

I use vi as my editor of choice too.
But I like to bring my own configuration with me, so I can use a few extra key-definitions. Ctrl-B and Ctrl-F are just begging for better single key assignments so I use the square brackets [ and ] instead.

I also define comma "," as "i [ESC]" (to insert just one space)

And "\" is defined as ":m--[Ctrl-M]" (move current line up 1)
with "=" defined as ":m+[Ctrl-M]" (move current line down 1)

Lastly Ctrl-T is "WdWBP" (swap two whitespace delimited words)

Anyone else have any really useful custom keys?


Vi good, not vi = bad.

Post 11

Caveman, Evil Unix Sysadmin, betting shop operative, and SuDoku addict (Its an odd mix, but someone has to do it)

As this thread seems to have been suddently brought back from the dead after over four years, I thought I'd add a few things..

When I still hack C using vi on windows, it's now a real vi, running on top of the Cygwin toolkit, which if far easier to get on with than DOS-based attempts at providing unix-like tools on win32.

The cygwin kit also provides a number of other benefits. Proper socket code for one thing, but the main thing that has been of use lately is a select() function that actually works, unlike the one in Visual C.

The Microsoft select() function will not work over two different classes of I/O device, such as, in my case, a serial port and a network socket, whereas the cygwin glibc select() happily waits on both serial port and socket, so my ericsson telephone exchange management software can run on a win32 server, and talk to both the exchange and also to it's users via network sockets, without all that tedious mucking-about with winsock2.dll

Anyway, enough of that, as it's turning into a rant, so I'll go off and rant in my journal instead...


Key: Complain about this post