ANN: Enjoy formatted text in Vim with the txtfmt plugin (v1.0d beta)!

107 views
Skip to first unread message

Stahlman Family

unread,
May 6, 2008, 8:37:01 AM5/6/08
to vim...@googlegroups.com
Release version: 1.0d (beta)

Download page:
http://www.vim.org/scripts/script.php?script_id=2208

Screenshots:
http://www.freewebs.com/txtfmt

The txtfmt plugin is for anyone who has ever wished to create arbitrary
formatting regions while editing plain text in Vim.

Vim's syntax highlighting is very useful for editing files in a
particular programming language such as C or Perl. But what if you are
simply using Vim to edit text that doesn't fall into any particular
language category: e.g., personal journal entries, miscellaneous notes
or generic documents? In such cases, Vim's statically defined syntax
regions are not very useful. What is really needed is a word processor's
ability to apply formatting attributes to an arbitrary selection of
text. I myself have resorted to a word processor on more than one
occasion because of its ability to format text. As an inveterate Vim
user, however, I feel something like a "fish out of water" while editing
text in a word processor. My fingers often execute a Vim key sequence
before my brain realizes that the functionality is not supported. If
only I could create arbitrary formatting regions within Vim itself, I
would have the best of both worlds: editing efficiency and beautiful
text. With the txtfmt plugin, it is possible to have both!

I've pasted portions of the download page at the end of this
announcement to give an overview of the functionality provided and how
it works. Note that the download page contains a "quick-start tutorial"
(omitted from this post), which probably offers the quickest way to get
up and running with txtfmt. Additionally, the download package contains
an exhaustive help file, which you may use in conjunction with the
tutorial to familiarize yourself with the plugin's many features and
options. (:help txtfmt) Although the default options are designed to
permit the plugin to work well "out of the box", if you use the plugin
extensively, you should probably make a conscious choice regarding at
least the 'tokrange' option. (:help txtfmt-'tokrange')

I would *greatly* appreciate feedback from users. Even emails that do
not report problems are useful to me, as they help me gauge how much,
and with what degree of success and satisfaction, the plugin is being
used. Feel free to contact me directly at...

bretts...@comcast.net

...or post to the list with txtfmt in the subject.

Thanks,
Brett Stahlman

From the download page...

========
OVERVIEW
========
Txtfmt is a combination syntax/filetype plugin that allows you to create
and view formatted text with Vim. "Formatting" in this context refers to
8 (configurable) colors and all of the format attributes supported by
your version of Vim: i.e., bold, underline, italic, standout, reverse,
and (for Vim versions >= 7.0) undercurl. The formatting is accomplished
through the use of invisible, single-character "tokens", which define
the color and format attributes for subsequent text. The tokens
themselves are concealed by Txtfmt's syntax file, so that each appears
as a single space, providing an editing environment that is truly
WYSIWIG ("what you see is what you get"). Moreover, because the
concealment is performed entirely by Vim's syntax highlighting
mechanism, there is no need for the "conceal" patch. The range of
characters used as formatting tokens is user configurable, as are a
great many aspects of this plugin. All of txtfmt's options and features
are documented in an extensive help file included in the download
package. Additionally, this page contains a "quick-start" tutorial,
intended to help the new user get up and running quickly with txtfmt.

============
MORE DETAILS
============
Txtfmt's formatting tokens come from a range of character codes defined
by the user. The default start token is currently 180, although 0xE000
(the start of Unicode's "Private Use Area") is probably a better choice
for utf-8 encodings.
:help txtfmt-choosing-token-range
Txtfmt requires 9 distinct tokens for the 8 (configurable) color
regions (since one token is required to represent "no color"). The
number of tokens required for format regions varies according to the
txtfmt-specific 'tokrange' option setting.
:help txtfmt-'tokrange'
If, for example, the "short" tokrange qualifier is used, then the only
formatting attributes in use are bold, underline and italic. All
possible permutations of these attributes may be represented with only 8
tokens. If, on the other hand, the "long" qualifier is used in the
setting of 'tokrange', the set of available format attributes expands to
include standout, reverse and (for Vim versions >= 7.0) undercurl. In
this case, txtfmt will require either 32 or 64 format tokens, depending
upon whether your version of Vim supports undercurl.

The 2 types of regions begun by the 2 types of tokens (color and format)
are "orthogonal", meaning that a format token has no effect upon
coloration, and a color token has no effect upon formatting. For
example, suppose you have begun a green color region by inserting the
appropriate color token (with one of txtfmt's mappings, to be discussed
later). You now wish to emphasize a word or phrase by formatting it in
bold italics, but you do not wish to change the color. In this case, you
would simply insert the format token denoting "bold italic", and
subsequently typed text would be green bold-italic. If you later wished
to switch back to normal green text, you would simply insert the "no
format" token to turn off the bold-italic attribute without affecting
the color. Note that the "no format" token was necessary only because we
wished to turn off format attributes completely. It would not have been
required, for instance, to transition from green bold-italic to green
underline, because an underline token implicitly ends a bold-italic
region. Note that format and color tokens may be freely interspersed
with one another in any order.

All of the tokens described above are simply characters belonging to the
character set in use (e.g. latin1, utf-8, etc...), so it would be
theoretically possible to accomplish the highlighting with a syntax file
alone, by inserting the token characters with CTRL-V or something
similar. However, this would require you to memorize the character codes
corresponding to 8 colors and all combinations of underline, bold,
italic, etc... Thus, in addition to a syntax file, txtfmt provides a
filetype plugin (ftplugin), which provides mappings and functions to
facilitate working with the format/color tokens. Inserting tokens,
finding (jumping to) tokens, and querying token type, are just a few of
the operations that can be performed with mappings and/or functions
defined in the ftplugin.

==============
SUGGESTED USES
==============
The following applications represent a few of the many possible uses of
the txtfmt plugin:
-As part of a personal journaling system
-For taking "understanding" notes
(e.g., notes taken while reviewing large programming projects)
-For sprucing up programming language comments
Don't laugh! You can embed txtfmt formatting regions within other
syntax regions (e.g., C comments)
:help txtfmt-'nested'
-etc. etc...
Note: If you wish to make your formatted documents available to non-Vim
users, simply use the :TOhtml command distributed with Vim to output an
HTML version of the txtfmt buffer.

=======
HISTORY
=======
I wrote the initial version of this plugin in 2004, but didn't release
it until April of 2008. Since I first had the idea for this plugin, I
have seen a number of requests on the Vim list for the functionality it
provides. Although I wanted to make the functionality available to
others, I resisted doing so until I had created a comprehensive help
file, and had added enough configurability to make the plugin suitable
for a large user audience. Note that because the initial version of the
plugin was written in the Vim 6 era, I made a conscious decision not to
use any Vim functionality that would require Vim 7.

====================
QUICK-START TUTORIAL
====================
See download page...

Stahlman Family

unread,
May 14, 2008, 8:28:09 AM5/14/08
to vim...@googlegroups.com

Stahlman Family wrote:
> Release version: 1.0d (beta)
>
> Download page:
> http://www.vim.org/scripts/script.php?script_id=2208
>
> Screenshots:
> http://www.freewebs.com/txtfmt
>
> The txtfmt plugin is for anyone who has ever wished to create arbitrary
> formatting regions while editing plain text in Vim.
>
.
.

>
> I've pasted portions of the download page at the end of this
> announcement to give an overview of the functionality provided and how
> it works. Note that the download page contains a "quick-start tutorial"
> (omitted from this post), which probably offers the quickest way to get
> up and running with txtfmt. Additionally, the download package contains

Sorry. Just realized this morning that I had deleted the "quick-start
tutorial" from the download page. It's back now...

Brett Stahlman
.
.


e')
>
> I would *greatly* appreciate feedback from users. Even emails that do
> not report problems are useful to me, as they help me gauge how much,
> and with what degree of success and satisfaction, the plugin is being
> used. Feel free to contact me directly at...
>
> bretts...@comcast.net
>
> ...or post to the list with txtfmt in the subject.
>
> Thanks,
> Brett Stahlman
>

.
.
.

Reply all
Reply to author
Forward
0 new messages