TEXT-VIMCOLOR(1)
π TEXT-VIMCOLOR β the manual, but make it cute
okay bestie, this one lives in the User Contributed Perl Documentation section of your manual pages, and it's literally called text-vimcolor. Come sit, we're gonna make Vim paint your files in pretty colors from the command line. π
β¨ VERSION β¨
version 0.29 β that's the one, no cap. π
πΈ SYNOPSIS πΈ
here's the vibe, copy-paste ready:
$ text-vimcolor FILENAME
# (like a colored "cat" (same as "text-vimcolor --format ansi FILENAME"))
$ text-vimcolor --format html --full-page FILENAME > OUTPUT.html
$ text-vimcolor --format xml FILENAME > OUTPUT.xml
$ text-vimcolor --format pdf FILENAME --output OUTPUT.pdf
like. it's a cat that went to art school. π
π¦ DESCRIPTION π¦
so basically: this program uses the Vim text editor to highlight text according to its syntax, and then turns that highlighting into ANSI, HTML, XML or PDF output. It works with any file type that Vim itself can highlight. Usually Vim will auto-detect the file format based on the filename (and sometimes it peeks at the contents of the file too, nosy queen π).
Exactly one filename should be given on the command line to name the input file. If you give none, the input gets read from STDIN instead. one file. that's the rule. π«Ά
If Vim can't guess the file type automatically, you can just tell it explicitly with the --filetype option. For example:
$ text-vimcolor --format html --filetype prolog foo.pl > foo.html
And real talk: this program is a command line interface to the Perl module Text::VimColor. slay. β¨
π OPTIONS π
here's everything it understands, no skipping, we do not gatekeep here:
--helpβ shows you a summary of the usage, including a list of options. the "what does this even do" button. π--debugβ turns on debugging in the underlying Perl module. This makes it print the command used to run Vim. so you can see the receipts. π§Ύ--all-syntax-groupsβ enables additional syntax groups instead of just the primary ones. Seeall_syntax_groupsinText::VimColorfor more information. more groups, more drama, more color. π--filetypefile-type β set the type of the file explicitly. The file-type argument should be something which Vim will recognize when set with itsfiletypeoption. Examples areperl,cpp(for C++) andsh(for Unix shell scripts). These names are case sensitive, and should usually be all-lowercase. lowercase bestie, always. π€--formatoutput-format β the output format to generate. Must be one of the following:ansiβ output text marked up with ANSI escape sequences (usingTerm::ANSIColor). This is like a colorized version ofcat(1).
You can alter the color scheme using the TEXT_VIMCOLOR_ANSI environment variable in the format of SynGroup=color;. For example:
TEXT_VIMCOLOR_ANSI='Comment=green;Statement = magenta; '
On windows the script will attempt to load Win32::Console::ANSI if the output is to STDOUT in an attempt to make the output more useful. You can disable this by setting TEXT_VIMCOLOR_NO_WIN32_ANSI=1.
htmlβ generate XHTML output, with text marked with<span>elements withclassattributes. A CSS stylesheet should be used to define the coloring, etc., for the output. See the--full-pageoption below. πxmlβ output is in a simple XML vocabulary. This can then be used by other software to do further transformations (e.g., using XSLT).pdfβ XML output is generated and fed to the FOP XSL-FO processor, with an appropriate XSL style sheet. The stylesheet uses XSLT to transform the normal XML output into XSL-FO, which is then rendered to PDF. For this to work, the commandfopmust be available. An output file must be specified with--outputwith this format. (yes,fophas to exist. we'll get to the β¨bugsβ¨ section, don't worry.)
Full details of the HTML and XML output formats can be found in the documentation for Text::VimColor.
--outputoutput-filename β specifies the name of the output file. If this option is omitted, the output will be sent to<STDOUT>. This option is required when the output format is PDF (because of limitations in FOP). okay so for PDF you literally have to use this. no exceptions. π¨--full-pageβ when the output format is HTML, this option will make the output a complete HTML page, rather than just a fragment of HTML. A CSS stylesheet will be inserted inline into the output, so the output will be usable as it is. full page, full serve. π½οΈ--no-inline-stylesheetβ when the output format is HTML and--fullpageis given, a stylesheet is normally inserted in-line in the output file. If this option is given it will instead be referenced with a<link>element. linking instead of embedding, we love a modular girlie. π--letname=value β when Vim is run the value of name will be set to value using Vim'sletcommand. More than one of these options can be set. The value is not quoted or escaped in any way, so it can be an expression. These settings take precedence over--unletoptions.
This option corresponds to the vim_let setting and method in the Perl module.
--unletname β prevent the value of name being set with Vim'sletcommand. This can be used to turn off default settings.
This option corresponds to the vim_let setting and method in the Perl module, when used with a value of undef.
π BUGS π
not me exposing the flaws, but we keep it honest:
- The PDF output option often doesn't work, because it is dependent on FOP, which often doesn't work. This is also why it is mind numbingly slow. π like. genuinely painful. set your expectations accordingly.
- FOP (0.20.3) seems to ignore the
background-colorproperty on<fo:inline>. If that's what it's meant to do, how do you set the background color on part of a line? girl. we don't know either. π«
π SEE ALSO π
Text::VimColorβ the whole reason any of this works, iykyk. π
π«Ά AUTHORS π«Ά
giving credit where it's soooo due:
- Geoff Richards
<qef@laxan.com> - Randy Stauner
<rwstauner@cpan.org>
π COPYRIGHT AND LICENSE π
the legal bit, but make it cute:
This software is copyright (c) 2002-2006 by Geoff Richards.
This software is copyright (c) 2011 by Randy Stauner.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free as in freedom bestie, go wild. π¦
and that's the whole page, periodt. π this one's from perl v5.42.0, dated 2025-07-25 β so like, still iconic, still current. go color something pretty. β¨ππ
π¦ where this page comes from
- fedora 43: perl-Text-VimColor 0.29-21.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms