sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

formatvim : Convert current file to colored HTML, BBCode or whatever

 script karma  Rating 16/6, Downloaded by 4216    Comments, bugs, improvements  Vim wiki

created by
script type
This plugin provides the ability to convert current file to colored HTML,
BBcode, (in future) LaTeX or whatever you have written specification for.

    ∙ Flexible format specifications.
    ∙ Ability to create abstract stylesheets.
    ∙ 'list' [1] and 'listchars' [2] options support (only tab, trail, eol and conceal
      for now).
    ∙ Side-by-side diffs support. format-side-by-side-diff [3]
    ∙ Support for creating numbered lines.
    ∙ Dynamic folds support. g:format_AllFolds [4]

Differencies with built-in :TOhtml [5]:
    ∙ For large files formatting using my plugin is faster.
    ∙ 'list' [1] and 'listchars' [2] options support.
    ∙ Background color for the whole line with differencies, not just for text
      (for g:html_no_pre [6]=1) and without trailing spaces (for
      g:html_no_pre [6]=0).
    ∙ Signs support. signs [7]
    ∙ Tags linked to their definition. Implemented for 2html in
      vimscript #2252. g:format_IgnoreTags [8]
    ∙ (HTML) Anchors in tags definition location: for copying links.
      g:format_HTMLAddLinkAtTagLine [9]
    ∙ Side-by-side diff based on tables (2html relies on lines having the same
      height which is generally false).
    ∙ Full conceal support: with g:format_FormatConcealed [10] set to 2
      formats-format-html generates both concealed and shown.
    ∙ Non-copyable signs, fold columns and numbers by default. 2html requires
      setting g:html_prevent_copy [11].
    ∙ 'fillchars' [12] vert suboption support (2html supports only diff and fold
    ∙ Matches and 'hlsearch' [13] support. g:format_FormatMatches [14]
    ∙ More correct highlighting in some cases.
    ∙ Support for formats other then HTML/XHTML (format-formats [15]). Makes it
      relatively easy to add new format to the list of supported formats
      (format-f-format.add [16]).
    ∙ 2html still has more options for HTML formatting though.
    ∙ Full 'foldcolumn' [17] support: 2html sets foldcolumn to either 'foldcolumn' [17]
      value or maximum fold level, whichever is greater, formatvim uses
      'foldcolumn' [17] value, fully emulating what vim shows.
    ∙ 'spell' [18] checking support. g:format_IgnoreSpell [19]

Plugin requires some additional plugins:
    ∙ frawor (https://bitbucket.org/ZyX_I/frawor)

Note: formatvim supports VAM (https://github.com/MarcWeber/vim-addon-manager).
      It is prefered that you use it for formatvim installation.

Project page: https://bitbucket.org/ZyX_I/formatvim
Documentation: http://vimcommunity.bitbucket.org/doc/format.txt.html

[1] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27list.27
[2] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27listchars.27
[3] http://vimcommunity.bitbucket.org/doc/format.txt.html#format-side-by-side-diff
[4] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_AllFolds
[5] http://vimcommunity.bitbucket.org/doc/syntax.txt.html#.3aTOhtml
[6] http://vimcommunity.bitbucket.org/doc/syntax.txt.html#g.3ahtml_no_pre
[7] http://vimcommunity.bitbucket.org/doc/sign.txt.html#signs
[8] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_IgnoreTags
[9] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_HTMLAddLinkAtTagLine
[10] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_FormatConcealed
[11] http://vimcommunity.bitbucket.org/doc/syntax.txt.html#g.3ahtml_prevent_copy
[12] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27fillchars.27
[13] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27hlsearch.27
[14] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_FormatMatches
[15] http://vimcommunity.bitbucket.org/doc/format.txt.html#format-formats
[16] http://vimcommunity.bitbucket.org/doc/format.txt.html#format-f-format.2eadd
[17] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27foldcolumn.27
[18] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27spell.27
[19] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_IgnoreSpell

install details
You can install this plugin using vim-addon-manager (vimscript #2905) plugin (install vim-addon-manager, run “ActivateAddons formatvim” and add “call vam#ActivateAddons(['formatvim'])” to your .vimrc. Vim-addon-manager will install all dependencies for you). You can also use archives attached to this page, they contain plugin with all dependencies, so you do not need to fetch them yourself.

Gentoo users can use the following mercurial overlay: https://bitbucket.org/ZyX_I/pluginloader-overlay.

Rating scripts is only available on the HTTPS page

script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
formatvim-4.3.tar.gz 4.3 2015-01-01 7.3 ZyX - Added g:format_FormatLinks [1] and g:format_LinkRegexes [2] options which control
  which text should be turned into links.
- Added v:hlsearch [3] support.
- Added support for matches created by matchaddpos() [4].
- Added support for spell [5] checker.
- Added missing diff argument to :Format: it was documented, but did not
  actually exist.

[1] http://vimpluginloader.sourceforge.net/doc/format.txt.html#g.3aformat_FormatLinks
[2] http://vimpluginloader.sourceforge.net/doc/format.txt.html#g.3aformat_LinkRegexes
[3] http://vimpluginloader.sourceforge.net/doc/eval.txt.html#v.3ahlsearch
[4] http://vimpluginloader.sourceforge.net/doc/eval.txt.html#matchaddpos.28.29
[5] http://vimpluginloader.sourceforge.net/doc/spell.txt.html#spell
formatvim-4.2.tar.gz 4.2 2013-09-13 7.4 ZyX HTML:
- Added g:format_HTMLAdditionalCSS [1] option that allows overriding some CSS
  properties from vimrc.
- Refactored and documented CSS classes used in specification: see documentation
  for g:format_HTMLAdditionalCSS [1].
- Added g:format_HTMLFontFamily [2] option that controls font-family CSS property.

Developer changes:
- Now using format-spec-@=@ [3] properly is not possible without specifying @$@.
  This change replaced used empirics (previously documentation said that you
  should make sure string "'." is not present before @=@ in your expr).

[1] http://vimpluginloader.sourceforge.net/doc/format.txt.html#g.3aformat_HTMLAdditionalCSS
[2] http://vimpluginloader.sourceforge.net/doc/format.txt.html#g.3aformat_HTMLFontFamily
[3] http://vimpluginloader.sourceforge.net/doc/format.txt.html#format-spec-.40.3d.40
formatvim-4.1.tar.gz 4.1 2013-09-11 7.4 ZyX New:
- Add specification for www.vim.org (very simple: just adds [N] and links at-
  the bottom): the above description and this message is formatted using it

- Improved computation of line width
- Made it also wiki-escape colons in anchors

Developer options:
- g:format_Debugging_Break configuration option that allows setting-
  breakpoints in generated functions
- g:format_Debugging_SaveO option that controls whether opts dictionary-
  contents should be listed
- Added format-spec-@!key@ [1] and format-spec-@!!key@ [2]: mutable dictionaries-
  that are able to hold state
- Removed opts.strescape

- Fixed AllFolds javascript: clicking on header link unexpectedly caused outer-
  fold close
- Fixed double escaping that happened with some options’ values
- Fixed closed folds appearance with 'foldcolumn' [3] set to 1
- Fixed some typos in CSS

[1] http://vimpluginloader.sourceforge.net/doc/format.txt.html#format-spec-.40.21key.40
[2] http://vimpluginloader.sourceforge.net/doc/format.txt.html#format-spec-.40.21.21key.40
[3] http://vimpluginloader.sourceforge.net/doc/options.txt.html#.27foldcolumn.27
formatvim-4.0.1.tar.gz 4.0.1 2013-09-09 7.4 ZyX Some AllFolds improvements:
- Added support for &foldminlines option
- Added sign, number and fold colum contents to the link text
- Improved JavaScript used by HTML AllFolds implementation
formatvim-4.0.tar.gz 4.0 2013-09-08 7.3 ZyX Added support for &concealcursor
Added IgnoreDiff option
Added options for HTML formatter, including
- an option to add links at the place where tag is defined (so that they can be easily copied)
- Added option that controls file name in anchors
- Added option that controls <title> contents
- Added option that enables generating human-readable style names
Added support for formatting matches
Add @<@expr@>@: compile-time evaluated expressions
Add addoptsfun format key
Major performance improvement of tags processing (requires vim-7.3.627)
Minor performance improvement of main formatting cycle
Removed caching
Removed concealed key, added concealedstart and concealedend
Added debugging options and profiling support
A big number of fixes
Made signs column use uncopyable <input> with background image for icons
formatvim-3.2.3.tar.gz 3.2.3 2012-12-07 7.3 ZyX Splitted plugin into autoload/format.vim and plugin/format.vim
Fixed progress bar
Fixed html-vimwiki style (both are regressions)
formatvim-3.2.2.tar.gz 3.2.2 2012-09-23 7.3 ZyX Improved unselectable columns
Made script that creates color file require almost no manual work
Improved perfomance
formatvim-3.2.tar.gz 3.2 2012-09-15 7.3 ZyX Added id="tag" spans to html specification
Added @__key@
Added support for &highlight
Added support for &numberwidth
Added csi format
formatvim-3.1.tar.gz 3.1 2012-06-30 7.3 ZyX Improved tags processing speed
Added starttagreg/endtagreg command-line options and StartTagReg/EndTagReg global options (useful for formatting help files)
Made html specification not use &nbsp;s anymore
formatvim-3.0.tar.gz 3.0 2011-06-19 7.3 ZyX Ported plugin to new framework
Various foldcolumn fixes
Fixed highlighting of line under cursor
Added signs support
Made numbers, fold and signs column uncopyable in html specification
Added fillchars option support
Minor perfomance improvement
Added to' prefix for :Format command, other API changes
formatvim-2.5.1.tar.gz 2.5.1 2011-04-04 7.3 ZyX Fixed error when creating side-by-side diff with difffillers at the end of buffers
formatvim-2.5.tar.gz 2.5 2010-12-19 7.3 ZyX Switched to new FormatCommand arguments model
formatvim-2.4.3.tar.gz 2.4.3 2010-12-18 9999 ZyX Reposting bundle due to core plugins update
formatvim-2.4.3.tar.gz 2.4.3 2010-12-11 7.3 ZyX Removed yamlvim dependency, added tokens format specification and @~@ and @^@, fixed formatting of closed folds
formatvim-2.4.2.tar.gz 2.4.2 2010-11-20 9999 ZyX Reposting bundle due to core plugins update
formatvim-2.4.2.tar.gz 2.4.2 2010-11-06 7.3 ZyX Moved color lists to config/formatvim/colors-*.yaml, made it possible to override colors
formatvim-2.3.4.tar.gz 2.3.4 2010-09-09 7.2 ZyX Added %!{cmd}!% format specification, added lcs:conceal support, added support for the case when 'lcs' does not have tab and 'list' is on, lots of bugfixes
formatvim-2.3.3.tar.gz 2.3.3 2010-08-28 7.2 ZyX Added tests, fixed one bug
formatvim-2.3.2.tar.gz 2.3.2 2010-08-28 7.2 ZyX Fixed displaying of blank lines
formatvim-2.3.1.tar.gz 2.3.1 2010-08-28 7.2 ZyX Added relative numbering support
formatvim-2.3.tar.gz 2.3 2010-08-28 7.2 ZyX Added concealed characters support
formatvim-2.2.1.tar.gz 2.2.1 2010-08-18 7.2 ZyX Fixed some validator errors
formatvim-2.2.tar.gz 2.2 2010-08-14 7.2 ZyX Added support for tags
formatvim-2.1.tar.gz 2.1 2010-08-08 7.2 ZyX Added support for more then two diff windows, some other fixes
format-2.0.tar.xz 2.0 2010-08-04 7.2 ZyX Added experimental side-by-side diff creation, added cursor position support (unfinished, disabled by default), major changes to format specification, some fixes
format-1.8.2.tar.xz 1.8.2 2010-06-30 7.0 ZyX Added «KeepColorCache» option, improved «bbcode-unixforum» format specification, some other fixes.
format-1.8.1.tar.xz 1.8.1 2010-06-30 7.0 ZyX Made «linestart'»and «lineend» keys optional, some fixes
format-1.8.tar.xz 1.8 2010-06-30 7.0 ZyX Added FormatCommand options that override both default and user settings.
format-1.7.tar.xz 1.7 2010-06-28 7.0 ZyX Added «html-vimwiki» format.
format-1.6.tar.xz 1.6 2010-06-06 7.0 ZyX Added commandline completion
format-1.5.tar.xz 1.5 2010-06-06 7.0 ZyX Added AllFolds option (for html format specification it is just like g:html_dynamic_folds for 2html, but you are free to write something else), ~8% perfomance improvement.
format-1.4.tar.xz 1.4 2010-06-06 7.0 ZyX Added "nolf" (joins everything in a single line) and "haslf" (allow format specification to define line breaks) format specification options.
format-1.3.tar.xz 1.3 2010-06-06 7.0 ZyX Added lcs:nbsp handling, some fixes
format-1.2.1.tar.xz 1.2.1 2010-06-06 7.0 ZyX Greatly improved performance (~37% for ShowProgress=0, ~53% for ShowProgress=1 and ~43% for ShowProgress=2).
format-1.2.tar.xz 1.2 2010-06-05 7.0 ZyX Added ShowProgress option (adds progressbar). Note that ShowProgress=2 makes my script ~30% slower while ShowProgress=1 slows down only for ~5%.
format-1.1.tar.xz 1.1 2010-06-05 7.0 ZyX Added NoLineNR (removes line numbering) and CollapsFiller (collapses too long diff fillers) options.
format-1.0.tar.xz 1.0 2010-06-05 7.2 ZyX 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.
SourceForge.net Logo