Path: utzoo!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!samsung!uunet!tellab5!vpnet!dattier From: dattier@vpnet.chi.il.us (David W. Tamkin) Newsgroups: comp.editors Subject: vi mapping difficulty Message-ID: <1991Mar08.205940.11108@vpnet.chi.il.us> Date: 8 Mar 91 20:59:40 GMT Organization: VPnet Public Access Unix, Villa Park, Illinois 60181-2206 Lines: 36 I'm having a problem with a key mapping in vi. If anyone can help, I'd surely appreciate it. I want to clear out any lines that don't have text on them. The purpose is to separate paragraphs in quoted text. So I have this in my .exrc: map ^X :v/[0-9A-Za-z]/s/.*//^M where ^X and ^M are ctrl-X and CR. The ^X doesn't need a ^V to be entered, but with or without it, or mapped to a printing character, the results are the same. Now, on some systems I call the mapping works fine. On all of them, if I type the command in, it works. But on other systems (including those I call most), if I try to use a mapping and call it by rebound key, these are the effects: If I've just read the file into the buffer and made no changes yet, it works. Otherwise, one or two occurrences of the pattern get replaced and the operation stops with "Can't undo in global" -- so who asked for an undo? It's not a matter of the "modified" flag, because if I do :w or :w! to write the buffer out and remove the flag, the operation (if called from a rebound key) still aborts with "Can't undo in global." If I :w and then :e %, it will work if I use it before making any more changes. Short of expecting the system administrators to install new versions of vi, is there any way I can change the mapping to make it function? Binding :g/^[^0-9A-Za-z]*$/s///^M to a key acts the same way. David Tamkin PO Box 7002 Des Plaines IL 60018-7002 dattier@vpnet.chi.il.us GEnie:D.W.TAMKIN CIS:73720,1570 MCIMail:426-1818 708 518 6769 312 693 0591 "Parker Lewis Can't Lose" mailing list: write flamingo-request@ddsw1.mcs.com