Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2002 03:22:44 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Jon Nathan <jon+dated+1035762594.214939@rupture.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: fmt(1) inside vi
Message-ID:  <20021021002243.GB3652@hades.hell.gr>
In-Reply-To: <20021020234954.GM79229@froody.rupture.net>
References:  <20021020234954.GM79229@froody.rupture.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2002-10-20 19:49, Jon Nathan <jon+dated+1035762594.214939@rupture.net> wrote:
> I'm trying to create a macro to justify a paragraph in vi.  Something
> similar to ctrl-j in pico.  I found fmt(1).  In its manpage, it says
> that  !}fmt  will justify a paragraph.  I can't get this to work
> though.  This is my .exrc:
> 
> :map v ^i# ^[j0
> :set wm=10
> :map E !}fmt
> :map F !Gfmt
> 
> So, E should justify the current paragraph.  F is supposed to justify 
> from the cursor position until the end of the file.  They both work in
> that they justify the text, but they add this: 
> 
> stty: stdin isn't a terminal
> 
> in the file.

This is usually an indication of a common abuse of the shell startup
files.  You have used biff(1) or mesg(1) in a startup file that is run
by non-interactive sessions of your shell.  Normally, users of csh(1)
should avoid using biff(1) or mesg(1) in their .cshrc files, or when
they do use these commands in .cshrc (which is used both by login and
non-login csh instances), they should attempt to protect the
non-interactive invocations of the shell from running these two
commands by wrapping them in if-endif blocks:

	if ($?prompt) then
		biff n
		mesg y
	endif

Note the difference between the following two csh subshells:

	keramida@hades[03:17]/tmp$ touch empty
	keramida@hades[03:17]/tmp$ csh -c tty
	/dev/ttyp2
	keramida@hades[03:17]/tmp$ csh -c tty < empty
	not a tty

> How can I make this work in vi (notwithstanding that vim is a
> workaround)?

By removing the offending commands from .cshrc (or the equivalent
startup file, for your shell), or properly checking that you are
running on a tty before attempting to use them.

Giorgos.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021021002243.GB3652>