kapil@zarquon.uchicago.edu (Kapil Paranjape) (01/02/91)
Is there a way to capture tha output of the ":set" command? This would make it easier to set up options for "vi" and then save this to the ".exrc" file. It woul also make it possible to write paragraph "fill" type commands that do not depend on a particular terminal width. I suppose one could think of other applications. Kapil Paranjape e-mail:kapil@zaphod.uchicago.edu
sid@binky.sybase.com (S. Cowles) (01/03/91)
In article <1991Jan1.205249.16530@midway.uchicago.edu> kapil@zarquon.uchicago.edu (Kapil Paranjape) writes: >Is there a way to capture tha output of the ":set" command? > ... >Kapil Paranjape >e-mail:kapil@zaphod.uchicago.edu one way is to invoke script, and then, within the script session, invoke ex (or vi) and issue the ":set all" command. output of the set command will be saved in the script file. sid cowles internet: uucp: sid@sybase.com {pacbell,sun,{uunet,ucbvax}!mtxinu}!sybase!sid scowles@humpty.llnl.gov {backbone}!lll-winken!humpty!scowles scowles@ccc.nersc.gov
was@hp-lsd.COS.HP.COM (Bill Stubblebine) (01/04/91)
kapil@zarquon.uchicago.edu (Kapil Paranjape):
> Is there a way to capture the output of the ":set" command?
The shell command
echo "set all" | ex > tmp
seems to do what you want. The output saved in file tmp is columnar, as it
would have been on the screen, but a simple sed script could fix that.
Bill Stubblebine
Hewlett-Packard Logic Systems Div.
8245 N. Union Blvd.
Colorado Springs, CO 80920
was@hp-lsd.hp.com (Internet)
(719) 590-5568
was@hp-lsd.COS.HP.COM (Bill Stubblebine) (01/04/91)
Earlier I wrote: > The shell command > > echo "set all" | ex > tmp > > seems to do what you want. The output saved in file tmp is columnar, as it > would have been on the screen, but a simple sed script could fix that. Further experimentation revealed that ex insists on forming the columns in the resulting option settings listing using direct cursor positioning commands (as determined from the current $TERM definition) even when the output is written to a file. This needlessly complicates editing the saved option settings. A better way to generate the option list is to set the terminal type to dumb before saving the options, then restore the terminal type as follows (I use ksh): export TERM=dumb echo "set all" | ex > tmp export TERM=the_actual_terminal_id This produces a space-separated columnar options list in file tmp. Bill Stubblebine Hewlett-Packard Logic Systems Div. 8245 N. Union Blvd. Colorado Springs, CO 80920 was@hp-lsd.hp.com (Internet) (719) 590-5568
wnp@iiasa.ac.at (Wolf PAUL ) (01/04/91)
In article <1991Jan1.205249.16530@midway.uchicago.edu> kapil@zarquon.uchicago.edu (Kapil Paranjape) writes: >Is there a way to capture tha output of the ":set" command? If you don't have the "script" command, you can use "tee". While you cannot really do any editing this way, you can type: vi | tee some_file then type ":set all" or ":map", etc., and then ":q". The output of the commands you typed, as well as a lot of screen control characters and other garbage, will be in "some_file", which can be cleaned up and used as the basis of an .exrc file.. -- W.N.Paul, Int. Institute f. Applied Systems Analysis, A-2361 Laxenburg--Austria PHONE: +43-2236-71521-465 INTERNET: wnp%iiasa@relay.eu.net FAX: +43-2236-71313 UUCP: uunet!iiasa!wnp HOME: +43-2236-618514 BITNET: tuvie!iiasa!wnp@awiuni01.BITNET
cosell@bbn.com (Bernie Cosell) (01/06/91)
was@hp-lsd.COS.HP.COM (Bill Stubblebine) writes: }A better way to generate the option list is to set the terminal type to }dumb before saving the options, then restore the terminal type as follows }(I use ksh): } export TERM=dumb } echo "set all" | ex > tmp } export TERM=the_actual_terminal_id Dunno about the ksh, but for a vanilla Bourne shell or derivative, the simple: echo set all | TERM=dumb ex > tmp works fine and is a bit less bother. /Bernie\