Non-equivalence of targets in vi

carl carl at bdaemon.UUCP
Wed Jan 22 04:28:00 AEST 1986


> All of the operators in vi can be used with nearly any target with count
> modifiers:
> 
> 	...
> 
> For example, "c2t," will change the text from the cursor position
> until the character before the second comma.
> 
> I say "nearly", because I can't seem to figure out how to do it with the
> section targets [[ and ]].  Suppose I want to delete the next two sections
> so that I could put them in a different place.  You'd think that
> 
> 	d2]]
> 
> would be the natural way to express this action, but vi just beeps me.
> I've also tried
> 
> 	2d]]	and	d]2]
> 
> to no avail.  Any suggestions?
> -- 
> Ken Turkowski @ CIMLINC, Menlo Park, CA

My apologies to all for my incorrect reply stating that this problem did
not exist in versions 3.7 and higher.  Not only does it exist, but the
command:

	d]]

cannot be repeated with dot (.).  The clue may be in a footnote in "An
Introduction to Display Editing with Vi", which reads:

	"The [[ and ]] operations require the operation character to be
	doubled because they can move the cursor far from where it
	currently is.  While it is easy to get back with the command ``,
	these commands would still be frustrating if they were easy to hit
	accidentally."

What we may have here is another example of a Berkeley UNIX program which
tries to do things *for* the user but ends up doing it *to* the user.

Again, I apologize for my earlier posting.

Carl



More information about the Comp.unix mailing list