Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (86 sloc) 1.98 KB
.TH FMT 1 "" "" "User commands"
fmt \- adjust line-length for paragraphs of text
.ad l
.B fmt
.RB [ \-w
.I width
.BR \-\fIwidth ]
.RB [ \-s ]
.RB [ \-c ]
.RB [ \-i
.IR chars ]
.RB [ \-C ]
.RB [ \-M ]
.RI [ file ]...
.ad b
This page describes the
.B Elvis 2.2_1
version of
.BR fmt .
.BR elvis (1).
.B fmt
is a simple text formatter.
It inserts or deletes newlines, as necessary, to make all lines in a
paragraph be approximately the same width.
It preserves indentation and word spacing.
If you don't name any files on the command line,
.B fmt
will read from stdin.
It is typically used from within
.BR vi (1)
.BR elvis (1)
to adjust the line breaks
in a single paragraph.
To do this, move the cursor to the top of the paragraph,
type "!}fmt", and
hit <Return>.
.IP "\fB\-w\fP \fIwidth\fP or \fB\-\fP\fIwidth\fP"
Use a line width of \fIwidth\fP characters instead of the default
of 72 characters.
.IP \fB\-s\fP
Don't join lines shorter than the line width to fill paragraphs.
.IP \fB\-c\fP
Try to be smarter about crown margins.
Specifically, this tells
.B fmt
to expect the first line of each paragraph to have a different
indentation than subsequent lines.
If text from the first input line is wrapped onto the second output line, then
.B fmt
will scan ahead to figure out what indentation it should use for the second
output line, instead of reusing the first line's indentation.
.IP "\fB\-i\fP \fIchars\fP"
Allow the indentation text to include any character from
.IR chars ,
in addition to spaces and tabs.
You should quote the
.I chars
list to protect it from the shell.
.IP "\fB\-C\fP and \fB\-M\fP"
These are shortcuts for combinations of other flags.
.RB \" \-C \"
is short for
.RB \" "\-c \-i'/*'" \"
and is useful for reformatting C/C++ comments.
.RB \" \-M \"
is short for
.RB \" \-i'>' \"
and is useful for reformatting email messages.
.BR vi (1),
.BR elvis (1)
Steve Kirkendall
Jump to Line
Something went wrong with that request. Please try again.