groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] poor man's wysiwyg for groff/gv


From: Tadziu Hoffmann
Subject: Re: [Groff] poor man's wysiwyg for groff/gv
Date: Tue, 18 Dec 2001 16:31:02 +0100

> Well, in "me-too" mode, I append the core of a script...

Cool!  Me too!  The "wysiwyg" posts have inspired me to
experiment a bit with those ideas.  I've come up with
the following:


Name the attached script "myroff" and make it executable.
Then start up vim (or gvim) and

  :map <F1> :w^M:!myroff %^M^M

edit your manuscript, press F1, and voila!

(You might have to tweak the "ps | grep" thingie
below a bit depending on the output of your ps.
You can set the :map command in your .vimrc.
Also, maybe "./myroff" above if the script is
in your current directory and not in your PATH.
If gv doesn't come up, try uncommenting the
"trap" line.  Uncomment "set -x" to see what
the shell is doing.)


----------------------------------------------------------------
#!/bin/sh

# set -x
# trap "" 1

  roff=$1
  post=`basename $1 .tr`.ps

  refresh(){
    test -z "$1" && { gv $post & } || kill -HUP $1
  }

  groff -Tps $roff >$post

# -- ps output is like "1308677 pts/19  S  0:00.38 gv test.ps" --
# -- first item is PID, used in refresh function as $1 --
# -- [0-9] matches time and is used to exclude the grep process --

  pid=`ps x | grep "[0-9] gv $post"`
  refresh $pid

----------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]