sponsor Vim development Vim logo Vim Book Ad

TextFormat : Quickly align and format paragraphs and text areas: left, right, justify, center

 script karma  Rating 42/19, Downloaded by 3491  Comments, bugs, improvements  Vim wiki

created by
Teemu Likonen
script type
This plugin provides commands and key mappings to quickly align and format text. Text can be easily reformatted and aligned to either left or right margin or justified to both margins or centered. The text formatting commands provided by this plugin are a bit more automatic and more intelligent than those integrated to Vim. Together they make more powerful command set for formatting text.

Manual is included, just type

    :help textformat.txt

Default keymappings:

    \al     Left-align and reformat
    \ar     Right-align
    \aj     Left-right justify and reformat
    \ac     Center lines

The prefix key is actually <Leader> key. It's backlash by default but it is configurable.
install details
The plugin uses Vimball plugin archive format (vimscript#1502). To install the package, load the file to Vim and run command

    :source %

To remove the plugin, type

    :RmVimball textformat

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
textformat.vba 2.1 2008-09-13 7.0 Teemu Likonen Minor internal cleanup
textformat.vba 2.0 2008-08-10 7.0 Teemu Likonen * \al and \aj now reformat text also in visual mode.
* \al and \aj honor "w" in 'formatoptions' and detect paragraph boundaries accordingly.
* :AlignLeft, :AlignJustify, \al and \aj recognize several paragraphs within the range and detect indent for each paragraph separately.
* Add logic to load the plugin script only once.
textformat.vba 1.1 2008-08-03 7.0 Teemu Likonen -- Keep cursor position more accurately when formatting a paragraph with \al and \aj.
-- When 'joinspaces' is set insert two spaces after .?! punctuation with left-right justify. This is now similar to other commands.
textformat.vba 1.0 2008-08-02 7.0 Teemu Likonen -- All the commands now follow user's 'expandtab' setting and print leading whitespaces accordingly. Now this works just like :left, :right and :center commands. -- The left-aligned last line in justified paragraph did not honor 'joinspaces'. Fixed.
textformat.vba 0.9 2008-08-01 7.0 Teemu Likonen Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.