Hi,

I made a private patch for nvi(1) that enable you to use new variable '@'
in arguments of ex's ! or !! command.

The '@' is similar to '%' which means the editing file name.
If you are editing file.c at 110 line then ':!echo @' means ':!echo 110'.

It is convenient to use with gozilla(1).
If you have hypertext of source code generated by htags with -l option then
you can display editing text on mozilla as a hypertext.

:!gozilla +@ %

Suggested .nexrc:
+--------------------------
|map ^G :!gozilla +@ %^M

But this is a serious modification of nvi's spec. You cannot use '@' as a
constant in nvi's shell command line.
So, you had better use this patch personally.

Here is a patch for /usr/src/contrib/nvi/ex/ex_argv.c in freebsd-current.

*** ex_argv.c.org       Fri Nov  1 15:45:30 1996
--- ex_argv.c   Thu Oct 14 20:30:04 1999
***************
*** 326,331 ****
--- 326,332 ----
        EX_PRIVATE *exp;
        char *bp, *t;
        size_t blen, len, off, tlen;
+       char b[30];
  
        /* Replace file name characters. */
        for (bp = *bpp, blen = *blenp, len = *lenp; cmdlen > 0; --cmdlen, ++cmd)
***************
*** 348,354 ****
                        F_SET(excp, E_MODIFY);
                        break;
                case '%':
!                       if ((t = sp->frp->name) == NULL) {
                                msgq(sp, M_ERR,
                                    "116|No filename to substitute for %%");
                                return (1);
--- 349,359 ----
                        F_SET(excp, E_MODIFY);
                        break;
                case '%':
!               case '@':               /* replace with line number */
!                       if (*cmd == '@') {
!                               snprintf(b, sizeof(b), "%d", sp->lno);
!                               t = b;
!                       } else if ((t = sp->frp->name) == NULL) {
                                msgq(sp, M_ERR,
                                    "116|No filename to substitute for %%");
                                return (1);
--
Shigio Yamaguchi - Tama Communications Corporation
Mail: [EMAIL PROTECTED], WWW: http://www.tamacom.com


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to