From nh@cbnewsg.cb.att.com (nicholas.hounsome) Subject: Re: UNIX COMMAND IN VI SESSION. Date: Fri, 2 Oct 1992 07:33:09 GMT >From article <=1=p9lb@lynx.unm.edu>, by hamjavar@carina.unm.edu (Farid Hamjavar): > > Hello : OCT-01-92 > > VI allows you to execute UNIX commands in a VI session. > How can I enter AT THE CURSER, the output of the UNIX's "date" command ? > :map ^X i^M^[:r!date^MddpkkJJ This will not work correctly at the end of a line because of the two joins. or :map ^X ma:r!date^Mj0d$`apmajdd`a This uses d$ to delete to the end of the line but not the newline and uses the little known but useful backquote which puts you at the marked character position. There is no way to read in directly at the cursor position because the read has to be done in ex line editor mode which does not understand cursor position (or `). > > > ThankS a lot. > Farid Hamjavar > hamjavar@carina.unm.edu Nic Hounsome From shrchin@csug.cs.reading.ac.uk (Jonathan H. N. Chin) Subject: Re: UNIX COMMAND IN VI SESSION. Date: 2 Oct 92 08:29:38 GMT hamjavar@carina.unm.edu (Farid Hamjavar) asked: >VI allows you to execute UNIX commands in a VI session. >How can I enter AT THE CURSER, the output of the UNIX's "date" command ? If you want the cursor to end up in the same place as it started: mao^[!!date^M"ad$`aPjdd`a where ^[ is the ESC key and ^M is the RETURN key. Alternatively to get the cursor to finish _after_ the inserted text: i^M^Mx^[k!!date^MkJxJxx Again ^[ is ESC and ^M is RETURN. The first and last x are not needed but ensure that no spaces are either added or deleted. Note that there are numerous other ways to do this operation. If you don't plan on using the above inside a macro, you can omit the named buffers from the first example, making it the same number of keystrokes as the second example. Or you can omit various bits if you don't care where the cursor ends up, etc. Jonathan -- Jonathan H N Chin, 8 kyu \ Dept. of Cybernetics, \ "Respondeo, etsi mutabor" \ University of Reading \ shrchin@uk.ac.rdg.susssys1 \ Box 225, Whiteknights \ < Rosenstock-Huessy > bq305@cleveland.freenet.edu \ Reading, RG6 2AY, U K \ From rac@sherpa.uucp (Roger Cornelius) Subject: Re: UNIX COMMAND IN VI SESSION. Date: Fri, 02 Oct 1992 14:13:43 GMT In article <=1=p9lb@lynx.unm.edu>, hamjavar@carina.unm.edu (Farid Hamjavar) writes: > > Hello : OCT-01-92 > > VI allows you to execute UNIX commands in a VI session. > How can I enter AT THE CURSER, the output of the UNIX's "date" command ? vi has no builtin way to do this. !!date will overwrite the contents of the current line, or :
r !date will insert the date at or after the current line if is not specified. Otherwise, create a macro to do what you want. -- Roger Cornelius sherpa!rac@uunet.uu.net ...!uunet!sherpa!rac From hansm@cs.kun.nl (Hans Mulder) Subject: Re: Paragraphs and vi Date: Mon, 5 Oct 1992 14:29:57 GMT In <1992Oct4.050951.2469@ils.nwu.edu> eric@ils.nwu.edu (Eric Goldstein) writes: >In vi, fmt can be invoked for the paragraph in question by >using the !}fmt command. >In my case, this just about works (but not quite). The >paragraph does get formated, but the system then inserts >a message directly into my text. Using the example I gave >earlier: >------------------------------------------------------------------ >stty: TCGETS: Operation not supported on socket Oh well, at least stty mentions it's name in the message you get. Biff just says "Where are you?", giving you no clue whatsoever. This is essentially question 2.7 in the FAQ for comp.unix.questions. The answer is that it is a problem with your .cshrc file (or equivalent for whatever shell you use.) That file contains a line with an stty command, maybe: stty erase ^H # or whatever If your shell is a C shell or compatible, change that to read: if ($?prompt) stty erase ^H # or whatever endif Or, if it's a Bourne shell compatible, make that: if [ ${PS1+x} = x ] then stty erase ^H # or whatever fi Oh, if there is a line starting with: set prompt= or PS1= respectively, put that line between the if/endif pair c.q. then/fi pair as well. -- Hope this helps, Hans Mulder hansm@cs.kun.nl From pckizer@tamsun.tamu.edu (Philip Kizer) Subject: Re: Piping just *1* line [Was: mapping space bar] Date: 27 Jan 1993 22:41:14 -0600 Once, djf@bnr.ca wrote: >BTW: > - is there a way to pipe just *1* line through a filter? I find things like > !jsome_command