Xref: utzoo comp.editors:929 comp.unix.questions:16283 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.editors,comp.unix.questions Subject: Re: Centering lines in vi Message-ID: <3221@solo1.cs.vu.nl> Date: 11 Sep 89 23:40:46 GMT References: <2283@umbc3.UMBC.EDU> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 44 rostamia@umbc3.UMBC.EDU (Rouben Rostamian) writes: \Does anyone know a combination of commands that will center a given line \(or better yet, a range of lines) in vi? I think you're better off filtering the range through some nroff shell script. Example (to set indentation and linelength): ----------8<----------8<----------8<----------8<----------8<---------- #!/bin/sh # usage: fill [indent] [linelength] # author: Hans-Juergen Ehling (eh@astbe.uucp) indent=${1-0} llength=${2-72} tmp=/tmp/format.$$ umask 077 /bin/rm -f $tmp exec 3>&1 > $tmp 4< $tmp /bin/rm -f $tmp echo ".hy 0 .ll $llength .in $indent" tr -s ' ' ' ' # To squeeze blanks nroff <&4 >&3 ----------8<----------8<----------8<----------8<----------8<---------- Usage: !}fill 3 78 to reformat up to the end of the paragraph. \A (perhaps) related question: \Is there a command that returns the current column position of the cursor \in vi? I guess not. :-( Maybe some disgusting macro... -- C, the programming language that's the same |Maarten Litmaath @ VU Amsterdam: in all reference frames. |maart@cs.vu.nl, mcvax!botter!maart