Subject: Re: is vi(1)'s autoindent the right default behaviour?
To: Luke Mewburn <>
From: Igor Sobrado <>
List: tech-userlevel
Date: 06/03/2005 16:52:02
> Actually, it can, and it's also "safer" to use the ":r! cat /dev/tty".
> Consider if you have:
>     *	showmatch enabled and you paste text with brackets in it.
> 	On a slow(er) terminal, vi will bounce the cursor around the screen.
>     *	wrapmargin enabled and you paste text that's too long; it will
> 	be automatically wrapped.
>     *	you have abbreviations defined and you paste text with those
> 	abbreviations in it; the abbreviations will be expanded.

You are absolutely right!  A cursor bouncing between brackets is a bit
annoying when using vi(1) remotely too (e.g., between machines in the
United States and Europe), abbreviations expanded and lines automatically
wrapped are serious issues when pasting text too.

> (Note: I have a key macros to toggle settings such as 'wm', 'list', 'number=
> ',
> 'ai', etc)

A fine customization!

> I.e, I use ":r! /cat/dev/tty" to perform the operation of
> "insert this chunk of text literally, with no translations".

Using vi(1)'s buffers is another option, but typing something like "a5yy
(missing quote is not an error here!) when yanking five lines is really
ugly.  ;-)

An off-topic on this thread: I wrote an email to both Jon Bentley
and Bob Sedgewick asking for permission to use the ternary search
tree implementation described in:

  Bentley, J. L. and Sedgewick, R.  Fast Algorithms for Sorting and
  Searching Strings.  Proceedings of the eighth annual ACM-SIAM symposium
  on Discrete Algorithms, Society for Industrial and Applied Mathematics
  (January 1997), 360-369.

(a ternary search tree is probably the most efficient data structure
for looking words in a dictionary).  They are kindly researchers and
agreed about using the code in the paper published at that ACM SIAM
symposium for this project.  Ternary search trees are being used in a
commercial OCR system built in Bell Labs too.

I will try to finish a prototype this summer (...I suppose that
this project cannot participate in Google's Summer of Code,

If this implementation is finally dropped, I hope that at least
some of the ideas in the code will be useful for the Foundation
members.  ;-)

Best regards,