Path: utzoo!mnetor!uunet!cadnetix.UUCP!beres From: beres@cadnetix.UUCP (Tim Beres) Newsgroups: comp.unix.questions Subject: Re: to space under vi, VI SUMMARY COMING SOON... Message-ID: <1937@cadnetix.UUCP> Date: 27 Jan 88 21:12:42 GMT References: <462@gordon.UUCP> <239@unicom.UUCP> Reply-To: beres@cadnetix.UUCP (Tim Beres) Organization: Cadnetix Corp., Boulder, CO Lines: 45 Keywords: vi, tab, vi summary In article <239@unicom.UUCP> daniel@unicom.UUCP (Dan "I want to Ski Tam!" Smith) writes: >In article <462@gordon.UUCP> kelvin@gordon.UUCP (Kelvin Lam) writes: >> >>Is there a way to force 'vi' editor to insert appropreiate number of spaces >>when key is hit? That is, instead of inserting the actual , >>n number of spaces are inserted. > >>Kelvin Lam >>(...!necntc!gordon!kelvin) > > > :g/ /s// /g > > globally, search for tabs, substitute 8 spaces globally (on a line). >Vi won't let you map the tab key, or I would suggest making a map! (input >mode macro) for it. Applying the above command may or may not apply to your >situation... Most likely maybe not. The problem being is that if you are at column 4 and hit a , you end up in column 9 (assuming std. tabs). If you simply replace the above w/ 8 spaces, the character following the original will wind up in column 12 - horribly mangling the elegant formatting of the original. Though I don't know how to map a either, the approach taken in other editors is: 1/ map to the sequence, a/ determine column position b/ determine the next tab stop c/ add (next tab stop - column) spaces Considering, of course, what to do if there is no next tab stop. If anyone does know how to map tabs, and how to determine the current column under vi, please let me (us) know. Thanks for the quick guides, Dan. Tim -- ----------------------------------------------------------------------- Tim Beres Cadnetix 303/444-8075 x221 5775 Flatirons Pkwy Boulder, CO 80301