Centering lines in vi

Maarten Litmaath maart at cs.vu.nl
Fri Sep 15 06:15:18 AEST 1989


hamlin at blackbird.afit.af.mil (Joe Hamlin) writes:
\...                                   The 
\                                   following 
\                                 macro seems to 
\                             work just fine.  These 
\                           painful-to-read lines were 
\                                 centered with 
\                                      it. 
\
\map v $ma81a ^[81^V|D`alld0:s/  / /g^M$p^M

A nice map, but it has a small bug: try to center a line that's been centered
already, or any line with indentation.  Furthermore, after applying the macro
every line ends in a space!
Let's try again:

	map v :s/^[ ^I]*//^V^M$ma81a ^V^[81^V^V|D`alxd0:s/  / /g^V^M$p^V^M
		 ^^		       ^^
		 NOT an escape	       this IS an escape
-- 
   creat(2) shouldn't have been create(2): |Maarten Litmaath @ VU Amsterdam:
      it shouldn't have existed at all.    |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.questions mailing list