sponsor Vim development Vim logo Vim Book Ad

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

 script karma  Rating 13/4, Downloaded by 1422    Comments, bugs, improvements  Vim wiki

created by
ZyX
 
script type
utility
 
description
There are some things that included out-of-the-box 2html.vim plugin does not support, so I ended in writing my own format.vim script:

    — 'list' and 'listchars' (tab, trail, eol, conceal, including the case when 'list' is on and 'lcs' does not contain tab);
    — Foreground colors for lines with differencies (if I am not mistaking, implemented in latest 2html);
    — Normal special character coloring;
    — Background color for the whole line with differencies and folds, not just for text;
    — Tags linked to their definition (slow, HTML only (unless you write specification by yourself), but partially on by default, also implemented by vimscript #2252 for 2html);
    — Side-by-side diff (also present in latest 2html version);
    — Full conceal support, including 'cole', 'lcs:conceal' and saving information about actual text present;
    — Foldcolumn support (2html generates foldcolumn only if dynamic_folds is on, and this foldcolumn is different from what Vim actually displays);
    — Signs support, including icons
    — Non-copyable foldcolumns and numbers
    — 'Fillchars' option support (diff, fold and vert keys);
    — My killer feature: exporting to any format you can write specification for. (for example, bbcode; bbcode specification for unixforum.org is included in the distribution).

Examples:
http://formatvim.sourceforge.net/folded.yaml_C0-D0-a0-n1-o3-r0.html
Side-by-side diff: http://formatvim.sourceforge.net/concealed.tex_diffformat.html
AllFolds: http://formatvim.sourceforge.net/folded.yaml_C1-D1-a1-n1-o3-r0.html
Concealed characters: http://formatvim.sourceforge.net/concealed.tex_C1-D1-F2-L0-c2-l_q_q-n0-r0.html, http://formatvim.sourceforge.net/concealed.tex_C1-D1-F1-L0-c2-l_q_q-n0-r0.html
Signs: http://formatvim.sourceforge.net/signs.yaml_signs__diffformat__diff__numbers.html
Signs with icons: http://formatvim.sourceforge.net/signs.yaml_icons.html

You can also see lots of examples in the mercurial repository: all test/*.ok. They are also duplicated at formatvim.sourceforge.net/*.html, exact names are generated out of *.ok files using the following command:
    zmv -C '(*).ok' 'outs/${${${${${1//_/__}//\%/_}//$/_d}//!/_b}//>/_g}.html'

Documentation: http://vimpluginloader.sourceforge.net/doc/format.txt.html
Project page: http://sourceforge.net/projects/formatvim
Dependencies (you do not need to install them by yourself, see installation details):
frawor: https://bitbucket.org/ZyX_I/frawor (vimscript #3631)
 
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: http://vimpluginloader.hg.sourceforge.net:8000/hgroot/vimpluginloader/pluginloader-overlay.
 

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
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  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: 107.20.7.65

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