"too much macro text" in Vi
Daniel Smith "innovation, not litigation..."
daniel at island.uu.net
Thu Aug 30 02:56:46 AEST 1990
Sun OS 4.0.3, Sparcstation 1+, /usr/ucb/vi
I came up with some macros to implement a "mark-ring" in Vi.
My problem is that if I use the macros a lot, I get the message
"too much macro text". I can repeat this behavior by starting
up Vi and tapping away at the macro keys for about a minute or two.
Here's what I'm doing in my .exrc
" jump to entries in our mark ring..keep tapping '=' to traverse
map ]1 :unmap =^M:map = ]2^M`a:"to mark 'a'^M
map ]2 :unmap =^M:map = ]3^M`b:"to mark 'b'^M
map ]3 :unmap =^M:map = ]4^M`c:"to mark 'c'^M
map ]4 :unmap =^M:map = ]5^M`d:"to mark 'd'^M
map ]5 :unmap =^M:map = ]1^M`e:"to mark 'e'^M
map = ]1
" add current point to the mark ring
map +1 :unmap -^M:map - +2^Mma:"marked 'a'^M
map +2 :unmap -^M:map - +3^Mmb:"marked 'b'^M
map +3 :unmap -^M:map - +4^Mmc:"marked 'c'^M
map +4 :unmap -^M:map - +5^Mmd:"marked 'd'^M
map +5 :unmap -^M:map - +1^Mme:"marked 'e'^M
map - +1
I can type the '-' key to mark my current point. Typing '='
moves me back through the last 5 points (the marks a-e). It works
pretty well, for perhaps a few hundred invocations. I'm wondering
what is building up in memory to give me the error. At first I
tried this without the calls to unmap, then added them thinking that
they would clear the problem up. As any Vi macro fan will
tell you, substitute C-m for all the ^M's. Thanks for any tidbits.
Daniel
p.s. yes, this is kludge, but it's the sort of neat one that Vi can
be arm-wrestled into. When I have some time between projects I'll
learn GNU Emacs...don't waste your fingertips trying to convert me :-)
--
.......Daniel Smith, Island Graphics, daniel at island.com dansmith at well.sf.ca.us
..(415)491 0765 x 250 (W) 4000 CivicCenterDrive SanRafael MarinCounty CA 94903
.disclaimer: If I don't write these things, Island will take away my coffee.
"The future is too important to leave to the pompous and stuffy people" -Ted N.
More information about the Comp.unix.questions
mailing list