Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!mtxinu!unisoft!peritek!dig From: dig@peritek.UUCP (Dave Gotwisner) Newsgroups: comp.misc Subject: Re: vi-like Message-ID: <560@peritek.UUCP> Date: 14 Mar 89 02:37:14 GMT References: <12406@dartvax.Dartmouth.EDU> <958@starfish.Convergent.COM> <415@corpane.UUCP> Organization: Peritek Corp., Oakland, CA Lines: 135 In article <415@corpane.UUCP>, sparks@corpane.UUCP (John Sparks) writes: > In article <2386@iscuva.ISCS.COM>, carlp@iscuva.ISCS.COM (Carl Paukstis) writes: > > > > EDITOR WARS! > > As for "unfriendly", vi is hard to LEARN, not hard to USE. I assure you, I > > can be quite productive with vi - especially for quick jobs. > > I agree with you there. It is hard to learn. But once you master the wierd > commands, it's not so bad. As far as full screen editors go, it's my last > choice, but it's not real bad. I too, agree. For really quick jobs, however, I use cat > file :-). I have been using VI since it's inception at UC Berkeley around '76 (or was it '77). At the time, VI was nearly impossible for me to learn, but now that I am familiar with it, other editors are just as hard (I am somewhat dyslexic, and I love the xp capability) for me to use. My debugging cycle consists mostly of edit/compile/[edit to fix typo from last edit]. Most of the commands aren't weird, if you are familiar with ed (which was the only editor really available on UNIX at the time VI was written), and when you reallize that most (true, not all) of the single letter commands are mnemonic for something. I wouldn't really consider VI a screen editor, since commands only affect either cursor movement or action around where the cursor is (ignoring what is actually on the screen). > > > > > Sure, vi has some drawbacks; mainly it's outweighed by special-purpose > > solutions. BRIEF is quite good on the PC, and I tend to use Micro-EMACS > > for larger, prolonged, complex multi-file editing. But I can't compile on > > my PC with M-E loaded; and I don't want to start it up again to correct a > > semicolon - so I fall back on vi. And that tends to increase my reliance > > on vi: I use it all the time, so I know the keys and commands. I still > > have to look things up for EMACS if I want to do anything complicated. And > > if I'm using somebody else's key bindings, I'm totally screwed. Why is the > > sequence 'dw' to delete a word "unfriendly"? > > well, dw is not so bad, but let's look at some of the other commands: > > dd = delete line (why? why not dl?) > ZZ = end edit and save file (!!!!) > $ = end of file > A = insert begining at end of line !?!?! > > > sure there probably are reasons for such cryptic commands. For instance, > the dd for delete line is for convenience in deleting lines, you just have > to keep pressing the same key and watch the lines disapear. But that doesn't > make it any easier to learn or any more friendly. There are meanings to all of these. In trying to keep to single letter commands, dd was needed, because without going back to ex mode :d, there is no easy way to delete a line (whose mnemonics make sense). Commands in VI are basically (3dw -- delete three words, 3dW -- use whitespace for determining words), and there isn't a line target (there are words, characters, and portions of screens, but no lines). ZZ was added because everyone hated typing ":wq" after the autowrite set option was added. $ is the end of line like in ed. I think $ in the shell and other programs took this meaning because of VI, but I am not sure. $ as the end of file is also because of ed. Ideally, any ED edit script will work with VI. A can be thought of as (A)ppend at end of line, just like a can be thought of as (a)ppend after cursor. I can be thought of as (I)nsert at start of line, just like i can be thought of as (i)nsert before cursor. See, they make sense (well... sorta...). Some wierder ones: hjkl (for left, down, up, and right) correspond to the arrow keys on ADM3A terminals (which were what we had when VI was written). With bigger address spaces, arrow key (multiple character inputs) were added. I only really use a few commands most of the time: o -- open a new line a -- append 0 -- goto start of line $ -- goto end of line fx -- find s -- substitute xp -- swap characters (delete/put character) r -- replace hjkl -- see above. This set seems to be more than sufficient for about 70% of what I do. When I need more, I use more, but I don't have to. > > Personally I like EDT (yes I grew up on DEC). It's easy to use, the keypad > is designed to do most of the editing commands, like del-word, del-line, go > to end of line, go to beginning of line, cut, paste, etc. > Probably 80% of my work at this company involves systems where I use EDT as opposed to VI. (RT, RSX, VMS). I have only one big complaint about EDT, and that is the versions are different on all three operating systems. In actuality, I have 4 different editors to remember how to use. Furthermore, EDT is different based upon which type of terminal you have (we use VT-52 and VT-100 lookalikes). Other than this, I too like EDT. You must remember that VI was designed when terminals did not have keypads. > > I like the keypad approach rather than the single letter commands in some > editors, because you don't have to leave insert mode in order to do editing. > Using macros, you could probably define your keypad to do interesting things: :map ^V ma :map ^V d'a :map ^V ^V0 :map ^V $ These will make the keys look something like the keys under EDT. If you don't like these things, you can redefine them to other things. The original VI, which ran on a PDP-11/70 under version 6 UNIX was rather sleek, without all the things that were added later (many of which we have gotten spoiled with), but again, remember the constraints you were limited to on that kind of architecture (Version 6 UNIX did not have overlays, and you were restricted originally to 64K for code+data 'cause it also originally ran on non-separate I/D machines), even EDT on the 11 uses overlays. -- ------------------------------------------------------------------------------ Dave Gotwisner UUCP: ...!unisoft!peritek!dig Peritek Corporation ...!vsi1!peritek!dig 5550 Redwood Road Oakland, CA 94619 Phone: 1-415-531-6500