Vi Tips

  1. Remove all blank lines from a file

    :g/^$/d
  2. Reload the current file and start again from scratch

    :e!%

    This uses external mode. The ":e!" tells vi to edit a file without saving the current file. The "%" specifies the current file.
  3. On a Linux, Unix, or Mac OS X system, you can reformat a paragraph so that lines fit in the terminal window withoug wrapping to the next line providing for a neat display in a terminal wndow with the following command:

    !}fmt

    This will insert line breaks in the text to fit the lines in the terminal window.

  4. Use } to move to the start of the next paragraph.

References:

  1. Vi ---> Removing blank lines
    Unix is a Four Letter Word
  2. Sample: Vi Tips and techniques
    Richard Botting's Home Page

Valid HTML 4.01 Transitional

Created: August 15, 2005 16:42