[comp.editors] word completion macro for vi

dan@sdl.scs.com (Dan Adler) (06/30/90)

Does anyone have a file completion utility for vi ? The idea is that you
are about to type :e or :n to a new file, and you suddenly don't remember
the full name, or it's too long. This is exactly like file completion in
csh using the escape key. Can you make vi do that ?

-- 
Dan  Adler						UUCP: dan@dan.scs.com
Mentor Graphics					phone: (201) 580-0102 
15 Independence Boulevard		Warren, NJ 07060
--	"a tautology is a tautology, and vice-versa." --

steinbac@hpl-opus.HP.COM (Gunter Steinbach) (06/30/90)

> / hpl-opus:comp.editors / bowles@is.s.u-tokyo.ac.jp (Eric E. Bowles) /
> 10:24 pm  Jun 19, 1990 /

> " Word completion (Komplete, Next, Previous).
> "
> :map! ^K ^[a.^[bmmi?\<^[b"zdt.@z^Mywmx`mPbea ^[dws
> :map! ^N ^[a.^[bdw`xnywmx`mPbea ^[dws
> :map! ^P ^[a.^[bdw`xNywmx`mPbea ^[dws

Great stuff.  I love it, including the additions by L. Quin and S.
Mullender.

However, on my system, an HP9000/350 running HP-UX6.5, the ^N (next)
function doesn't work.  If I type the mapped commands in one by one by
hand, it works fine, but when map!ped to ^N, the "n" command seems to
look not for the last search string but for what follows the "n".  E.g.
if I map! the sequence only up to the "y" following the "n", then the
cursor jumps to the previous "y".  And with the whole sequence map!ped,
it just can't find anything (except in this message, as I just tried
out, because it contains the same sequence, "ywmx`m....").

Has anybody else experienced this?  It could still be some interaction
with another of my many mappings, but I can't figure what.

Any pointers are greatly appreciated.

	 Guenter Steinbach		gunter_steinbach@hplabs.hp.com

steinbac@hpl-opus.HP.COM (Gunter Steinbach) (06/30/90)

Referring to my prevoius response, well I should have experimented a
little more before I wrote it.  I can't get the buggy behavior of n go
away, but I can work around it to make the ^N and ^P macros work:

Replace the n and N in the ^N and ^P macros by the sequences ?^M and /^M
respectively (that's control-M).  Now I'm happy!

Still, does anyone have a lead on the strange behavior of n in macros?

	 Guenter Steinbach		gunter_steinbach@hplabs.hp.com