If you use the vi or Vim text editors and wish to have lines automatically wrap to the next line when you get close to the margin, i.e., the 80th column, rather than having to hit the Return key, you can use the
wrapmargin
parameter, e.g., wrapmargin=10
.
To enter the command, while not in input mode type :wrapmargin=
followed by the number you wish to use for the wrap margin.
The wrapmargin parameter is set to an integer number of characters. When set to any nonzero number, vi will watch the lines that you type in the input modes. When you get to within the "wraprmargin" number of characters of the 80th character on the line, the next space character that you type will cause vi to enter a carriage return for you. This parameter gives vi a word wrap feature for entering text data. When set to zero, the wrap margin feature is disabled.
Source: Unix for Application Developers by William A. Parrette ©1991, page 320
If you wish to have vi display the current line and column number as
you type, use :set ruler
. If it is turned on you will see the
current line number and column number displayed at the bottom of the vi window,
e.g., 24,67
if you were on line 24 at column 67. The numbers
will change as you move the cursor whether you are in input mode or
not. You can turn it off with :set noruler
.
Alternatively, you can also use control-G on a Mac OS X system or Ctrl-G on a Linux system or with Vim on a Microsoft Windows system, i.e., hit the control, or Ctrl, and G keys simultaneously to see the current line and column numbers. You will see something like the following displayed at the bottom of the window:
"temp.txt" [Modified] line 30 of 34 --88%-- col 32
In the above example, while editing the file temp.txt the cursor was on line 30 of the 34 lines in the file and was at column 32 when I hit control-G. Since 30 is 88% of 34, the cursor was at a point 88 percent of the way through the file. Each time you hit control-G, the status information will be displayed for the current line and column when you hit the key combination.
With vi on a Mac OS X or Linux system, you can also use
!}fmt
when not in input mode, to automatically wrap the text in
a paragraph so that a line doesn't exceed column 80 in that paragraph from the
point where you enter that command.