Date: Thu, 14 Oct 1999 21:34:15 +0900 From: Shigio Yamaguchi <shigio@tamacom.com> To: hackers@FreeBSD.ORG Subject: Nvi's new variable '@' Message-ID: <199910141234.VAA07300@tamacom.com>
next in thread | raw e-mail | index | archive | help
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: shigio@tamacom.com, WWW: http://www.tamacom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199910141234.VAA07300>