home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.editors
- Path: sparky!uunet!microsoft!hexnut!georgere
- From: georgere@microsoft.com (George V. Reilly)
- Subject: Re: Arbitrary text blocks (Was: VI??? GROSS!)
- Message-ID: <1992Nov19.054551.26605@microsoft.com>
- Date: 19 Nov 92 05:45:51 GMT
- Organization: Microsoft Corporation
- References: <1992Nov17.145011.24541@Princeton.EDU>
- <1992Nov17.005252@gruc19.nor.chevron.com>
- Lines: 67
-
- hjiwa@gruc19.nor.chevron.com (Jeff Wang) writes:
- ) bvaughan@sheps.Princeton.EDU (Barbara Vaughan) writes:
- ) |> Back in the days when I mostly worked with MSDOS and had a good editor
- ) |> that handled rectangular blocks easily, I used to use it to prepare data
- ) |> so I COULD read it into a spreadsheet or word processor. For instance, if
- ) |> I have a file of formatted data:
- ) |>
- ) |> 123456789
- ) |> 987654321
- ) |>
- ) |> I can use my editor to insert a column of blanks in front of each field so
- ) |> it can be read into a spreadsheet program:
- ) |>
- ) |> 12 34 56 78 9
- ) |> 98 76 54 32 1
-
- ) You could use :%s\(..\)\(..\)\(..\)\(..\)\(.\)/\1 \2 \3 \4 \5/
- ) to do that.
-
- I use vi (or VIP, a vi emulation for GNU Emacs) all the time,
- and I seem to spend half my life building up complex regular
- expressions for searches and substitutions, but I don't find
- the above solution to be particularly satisfactory. It works,
- certainly, and I would use it if I had nothing better, but
- Emacs's rectangle commands, for example, would require much
- less thought.
-
- There's no way a non-programmer would come up with Jeff's
- solution, whereas many of them would use a block/rectangle
- insertion---if they knew about it.
-
- Yes, I know vi is primarily meant to be a programmers' editor,
- but many non-programmers end up having to use it and hating it,
- despite the widespread availability of other, simpler editors.
-
- ) |> I also found this feature useful when writing programs. Let's say I have
- ) |> a section of code I decide to make conditional, so I want to indent it to
- ) |> make an "if.. then.." block. I just insert a column of blanks in front of
- ) |> that section of code.
-
- ) You could use :'a,'bs/^/ / to shift a block to the right.
-
- Or mark the region and do a M-x indent-region, a solution
- that works in more complex cases too.
-
- I like vi: it starts up quickly, I can move around and change
- text much more quickly with the vi command set than with any
- other editor I know, and it's my editor of choice for making
- quick changes to a file. But I do all my serious editing in
- GNU Emacs: it has multiple buffers, multiple windows, and
- multiple undo; it has clever indenting (I now hate to write
- code with real vi); it has online manuals and other forms of
- help; it's customizable; it has built-in text formatting; and
- a pile of other features which I use infrequently, if at all.
- It's also big, bloated, often sluggish, and I don't like the
- standard keybindings (which is why I use the vi emulation).
-
- Vi can be made to do a lot of things, but it's often damned
- hard work. Why pipe a block of text out to fmt when you can
- press M-q to reformat it? (Actually, I usually use a vi
- macro which splits the line at the 65th character.) And I
- like pressing Return while typing in code and having the
- cursor automatically being in the right column.
-
- Keep masochism in the bedroom where it belongs.
- ________________
- George V. Reilly <GeorgeRe@Microsoft.Com>
-