Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

In vi, how do I set up line-wrapping and do paragraph filling?

Line-wrapping is done through the use of a variable in vi called wrapmargin. While in vi, to set up line-wrapping, press Esc, then type: :setwrapmargin=8 This will make the text you're typing wrap to the next line when it is eight letters from the right-hand side of the screen.

To set vi to always wrap text by default, edit or create a file called .exrc in your home directory, and add the following line: set wrapmargin=8

If you would like to reformat a paragraph after adding or deleting text from it, move the cursor to the beginning of the paragraph and enter the following: ESC!}fmt This calls fmt, an external program, to reformat the text. If you are on a System V Unix computer, you can substitute a different command by entering: ESC!}adjust -m70

To set up the letter  q  to do paragraph filling automatically, add the following line to your .exrc: file: map q !}fmt^M

To type ^M, press Ctrl-v , then press Enter.

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document adxx in domain all.
Last modified on August 22, 2008.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.