Can I use Vim and produce text with italics, bold and just a couple of colors?

1,369 views
Skip to first unread message

Paris

unread,
Apr 3, 2009, 1:31:51 PM4/3/09
to v...@vim.org
Hello,

I 'm not sure this is actually a vim question and if you dont feel like
answering or if you think it is inappropriate to ask such questions
here, just ignore me...

The thing is I hate document processors. I really do.
I love vim. I really really do.

But "they" want a .doc file. With italics, bold, red for the code and
green for page count.

I tried editing with vim and then opening with open office writer
coloring, italizing, bolding and saving to .doc. But it is painful! To
much mouse work... select the text go press the stupid B or I button or
go press font color and then red or green. Painful.
I want to use my keybord and only my keyboard.

So here is what I thought. I will edit an html document, open it with
oowriter and save to .doc.

And here is the question:

Is there an even easier way to do this using my vim?

Paris

unread,
Apr 3, 2009, 6:18:34 PM4/3/09
to v...@vim.org

Tim Chase

unread,
Apr 3, 2009, 6:48:53 PM4/3/09
to vim...@googlegroups.com
> The thing is I hate document processors. I really do. I love
> vim. I really really do.

Ditto :)

> But "they" want a .doc file. With italics, bold, red for the
> code and green for page count.

To get this from plain-text, you need _some_ sort of text markup
(he types, using underscores to mark up the sentence). There are
literally hundreds if not thousands of markup languages, and you
can even produce your own fairly easy (one of the main
contributing factors to the large numbers). Choices include RTF,
HTML, Markdown, DocBook, LaTeX...the list goes on and on.

> I tried editing with vim and then opening with open office
> writer coloring, italizing, bolding and saving to .doc. But it
> is painful! To much mouse work... select the text go press the
> stupid B or I button or go press font color and then red or
> green. Painful. I want to use my keybord and only my keyboard.
>

As an aside, in most word-processors, you should be able to
select by holding down <shift> while using motion keys (arrows,
control+arrows, home, end, pgup/pgdn, etc). You can then use
control+B to get bold, control+I to get italics. Colors, not
usually as readily available. But that's 2/3 of a solution. :)

> So here is what I thought. I will edit an html document, open
> it with oowriter and save to .doc.
>
> And here is the question:
>
> Is there an even easier way to do this using my vim?

Choose some markup that's easy for you, and then post-process it
to tweak it to be valid HTML. I happen to think fairly natively
in basic HTML (wrote most of my college papers in HTML using a
text-editor and then printed from the library for free instead of
the $0.07/pg in the labs; darn javascript end-note library I
wrote from scratch :), so I just started there. HTML has good
control for styling and doing things like code-blocks, or
defining <div>/<span> elements for page-counts.

However, your markup can be as simple as

<code>
here's some code
</code>
@42@

which you can then post-process to HTML (bound in a
script/keystroke to save your sanity)

:%s/@\(\d\+\)@/<span class='page'>\1<\/span>/g

Vim has fairly strong support for HTML so I know that's pretty
easy. You don't mention what's getting italicized, bolded, or
made red, so I'm not sure if there's a better/worse way to mark
those up.

If you're willing to put up with RTF markup, you can do this
natively in Vim and just open the resulting file directly in Word
or WordPad (most users see the idiot-icon for Word and don't care
that it's an RTF file instead of .DOC as long as it opens in
Word). I think OO.o does .rtf as well (when forced to use a
document processor, I tend to use AbiWord because it's a bit more
light-weight on my old machine here).

Hope this gives you some ideas,

-tim

Paris

unread,
Apr 3, 2009, 7:04:15 PM4/3/09
to vim...@googlegroups.com
I think I will stick to html... But I will check Abiword...

Thank you for your reply...

Ben Fritz

unread,
Apr 3, 2009, 11:01:25 PM4/3/09
to vim_use
First of all, please bottom-post to this list, as stated in our list
policy:

http://groups.google.com/group/vim_use/web/vim-information

Secondly, Vim can do pretty much everything you want here, in two
steps:

Step 1: Download the TxtFmt plugin. This will allow you to arbitrarily
color plaintext in Vim.

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

Step 2: Use the officially distributed "to html" plugin to
automatically build an HTML document containing all the text in your
document, complete with pretty highlighting. Simply execute
the :TOhtml command and watch it go.

Before doing step 2, it would be helpful to read up on the command and
all its options. :help :TOhtml will get you there. You almost
certainly want to set g:html_use_css, for example (for some reason you
need to opt in to non-broken html).

If you're interested in showing off, you can download my patch for
2html.vim that allows you to define folds in your document that also
show up in the converted HTML with interactivity. The patch is
available on this vim_dev thread (make sure to get the last iteration
submitted):

http://groups.google.com/group/vim_dev/browse_thread/thread/84bcdc1a7e56e14d/3ce6979d955e4f52

Paris

unread,
Apr 4, 2009, 5:08:02 AM4/4/09
to vim...@googlegroups.com
On Fri, 2009-04-03 at 20:01 -0700, Ben Fritz wrote:
> First of all, please bottom-post to this list, as stated in our list
> policy:

I'm sorry! I will keep it in mind.

On Fri, 2009-04-03 at 20:01 -0700, Ben Fritz wrote:
> Download the TxtFmt plugin.

I will give it a try...

Thank you.


Paris

unread,
Apr 4, 2009, 6:59:55 AM4/4/09
to vim...@googlegroups.com
On Fri, 2009-04-03 at 20:01 -0700, Ben Fritz wrote:
> Step 1: Download the TxtFmt plugin. This will allow you to arbitrarily
> color plaintext in Vim.

I downloaded the plugin and extracted the files to ~\.vim\plugin
~\.vim\ftplugin ~\.vim\doc etc...
Should I add something to my vimrc to load the plugin? I am confused...

Also I did not quite understand this. Do I have to use a special
filetype? How are my changes saved on a simple txt file?

Stahlman Family

unread,
Apr 4, 2009, 8:21:50 AM4/4/09
to vim...@googlegroups.com


Paris wrote:
> On Fri, 2009-04-03 at 20:01 -0700, Ben Fritz wrote:
>> Step 1: Download the TxtFmt plugin. This will allow you to arbitrarily
>> color plaintext in Vim.
>
> I downloaded the plugin and extracted the files to ~\.vim\plugin
> ~\.vim\ftplugin ~\.vim\doc etc...
> Should I add something to my vimrc to load the plugin? I am confused...

First, I would suggest reading the "QUICK-START TUTORIAL" section on the
download page, but see further down for some ideas on the overall setup...
>
> Also I did not quite understand this. Do I have to use a special
> filetype? How are my changes saved on a simple txt file?

There are many ways to use Txtfmt. It can be as simple as...
:set ft=txtfmt
...in the buffer you want to format. In general, though, you will
probably want to set things up so that when you open a particular file
or particular type of file, Txtfmt is loaded automatically. The way to
cause Txtfmt to be loaded for a particular file is to use a "Txtfmt
modeline". To use this method, you would put lines similar to the
following at the top or bottom of your file:

vim: ft=txtfmt
txtfmt: rng=0xE000S

The first line is a Vim modeline (:help modeline), which sets
vim-specific options and ensures that when the file is loaded,
'filetype' is set to "txtfmt". The second line is a "Txtfmt modeline"
(:help txtfmt-modeline), which sets Txtfmt-specific options. For details...
:help txtfmt-options
:help txtfmt-opt-list
:help txtfmt-Tokrange

Alternatively, you can use filetype autocommands to ensure that Txtfmt
is loaded whenever a file with a particular extension is opened. To use
this method, you could put something like the following in your
filetype.vim (e.g., in ~/.vim/filetype.vim):

au BufRead,BufNewFile *.txt setfiletype txtfmt

(Of course, you can associate Txtfmt with whatever extensions you like.)
You can even use Txtfmt in conjunction with other filetypes. I use
Txtfmt to supplement the regions defined by my electronic journal
filetype (jnl). I set it up like this:

*** in filetype.vim ***
" Use special dot-syntax to have both jnl and txtfmt filetypes load in
" sequence
au BufRead,BufNewFile *.jnl setfiletype jnl.txtfmt

*** at top of the journal file itself ***
vim:noet:tw=78:sw=4:ts=4:nojoinspaces
txtfmt:tokrange=0xE000s

Let me know if any of the above is unclear or you have any issues or
questions..

Thanks,
Brett Stahlman

>
>
> >
>

Dotan Cohen

unread,
Apr 4, 2009, 9:42:05 AM4/4/09
to vim...@googlegroups.com
> As an aside, in most word-processors, you should be able to
> select by holding down <shift> while using motion keys (arrows,
> control+arrows, home, end, pgup/pgdn, etc).  You can then use
> control+B to get bold, control+I to get italics.  Colors, not
> usually as readily available.  But that's 2/3 of a solution. :)
>

It can be the whole solution if the OP uses Open Office styles. He
sets all code as style "Code" then sets style "Code" as colour red.

> However, your markup can be as simple as
>
>   <code>
>   here's some code
>   </code>
>   @42@
>
> which you can then post-process to HTML (bound in a
> script/keystroke to save your sanity)
>
>   :%s/@\(\d\+\)@/<span class='page'>\1<\/span>/g
>

Wouldn't this be easier:
<dive style="code">
here's some code
</div>

And then a CSS rule for code.

--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

Paris

unread,
Apr 4, 2009, 9:53:28 AM4/4/09
to vim...@googlegroups.com

On Sat, 2009-04-04 at 16:42 +0300, Dotan Cohen wrote:
> .... Wouldn't this be easier: .....

Actually the easiest proved to be this:
<style type="text/css">
h1 {display:inline; color:#ff0000; font-size:1em; }
h2 {display:inline; color:#ff00ff; font-size:1em; }
</style>

Plus the <i> and <b>.

Thats all I need. Then I convert html to doc with OO.org (is there a
script available?)

On Sat, 2009-04-04 at 07:21 -0500, Stahlman Family wrote:
> There are many ways to use Txtfmt.....

Brett, thank you for your response...
Txtfmt probably wont work for me... I need to be able to have colored
text right next to uncolored with no space between.
I think html will be just fine...

thanx anyway.

Tim Chase

unread,
Apr 4, 2009, 10:11:27 AM4/4/09
to vim...@googlegroups.com
>> <code>
>> here's some code
>> </code>
>> @42@
>
> Wouldn't this be easier:
> <dive style="code">
> here's some code
> </div>
>
> And then a CSS rule for code.

<code> is a legit HTML element, so I'd just use it as-is.

-tim


Tony Mechelynck

unread,
Apr 4, 2009, 10:17:37 AM4/4/09
to vim...@googlegroups.com

If the plugin (which I don't know) includes a *.txt help file for the
/doc/ subfolder, then after downloading it there you should do (with the
paths shown above)

helptags ~/.vim/doc

in order to make it part of your Vim installation's integrated help.
Otherwise (and assuming, of course, that your vim is compiled with
+autocmd +eval and that your vimrc or something it sources has a line
reading

filetype plugin on
or
filetype plugin indent on

), then nothing is required beyond dropping the files into the right
subfolders and restarting Vim. The same mechanism which loads the
standard global plugins and filetype-plugins distributed together with
Vim will find your local additions too.

HOWEVER:
- If you are on Unix/Linux (or on Windows using the Cygwin version of
Vim) you should use only _forward_ slashes as path separators;
- If you are on Windows with the native-Windows version of [g]vim, you
may use either forward or backward slashes, but you should download the
files into subfolders of ~/vimfiles/, not of ~/.vim/.
- On any platform you may also use $VIM/vimfiles/ (not .vim even on
Unix) instead of ~/.vim or ~/vimfiles, if you want to make the plugins
available to all users (all login names) and not private to yourself.
Where exactly that will be will vary among OSes: on Windows $VIM will
typically be C:\Program Files\vim (aka C:\PROGRA~1\vim) or somesuch
while on Unix it will be /usr/local/share/vim or somesuch.


Best regards,
Tony.
--
How many seconds are there in a year? If I tell you there are
3.155 x 10^7, you won't even try to remember it. On the other hand,
who could forget that, to within half a percent, pi seconds is a
nanocentury.
-- Tom Duff, Bell Labs

Tony Mechelynck

unread,
Apr 4, 2009, 10:39:32 AM4/4/09
to vim...@googlegroups.com
On 04/04/09 15:53, Paris wrote:
[...]

> I think html will be just fine...
[...]

If you feel at ease writing HTML as text, and even more if you know how
to link it with the three possible kinds of CSS (in "style=" attributes
in tags, in a <style type="text/css"> tag as part of the <head>, or
external with <link rel="stylesheet" type="text/css"
href="whatever.css">), then awesome results can be achieved. But (like
every new "language") it does take some getting used to, at first.


Best regards,
Tony.
--
"Plaese porrf raed."
-- Prof. Michael O'Longhlin, S.U.N.Y. Purchase

Dotan Cohen

unread,
Apr 4, 2009, 11:02:18 AM4/4/09
to vim...@googlegroups.com
> <code> is a legit HTML element, so I'd just use it as-is.
>

I did not know that, thanks!

Michael Maurer

unread,
Apr 4, 2009, 9:12:00 AM4/4/09
to vim...@googlegroups.com
* Stahlman Family <bretts...@comcast.net> [04.04.2009 14:21]:

>
> Let me know if any of the above is unclear or you have any issues or
> questions..
>
> Thanks,
> Brett Stahlman

I don't know if it's the way my terminals are set up, or maybe I need to
compile vim with some extra optioni (latest stable with ruby support),
but I get this when I do
:MakeTestPage

http://michaelmaurer.net/images/gnometerminal.png
http://michaelmaurer.net/images/xterm.png

I put this in my .vimrc

set t_Co=256
set term=gnome-256color

but get no change (I dl'd the ncurses-term package you specified) .

I'd really like to use your plugin, it looks great!
- Mike

--
Entering the Ballardosphere
http://michaelmaurer.net/archives/2009/04/03/entering_the_ballardosphere/index.html

Brett Stahlman

unread,
Apr 4, 2009, 4:32:43 PM4/4/09
to vim_use


On Apr 4, 8:12 am, Michael Maurer <salogynso...@gmail.com> wrote:
> * Stahlman Family <brettstahl...@comcast.net> [04.04.2009 14:21]:
>
>
>
> > Let me know if any of the above is unclear or you have any issues or
> > questions..
>
> > Thanks,
> > Brett Stahlman
>
> I don't know if it's the way my terminals are set up, or maybe I need to
> compile vim with some extra optioni (latest stable with ruby support),
> but I get this when I do
> :MakeTestPage
>
> http://michaelmaurer.net/images/gnometerminal.pnghttp://michaelmaurer.net/images/xterm.png
>
> I put this in my .vimrc
>
> set t_Co=256
> set term=gnome-256color
>
> but get no change (I dl'd the ncurses-term package you specified) .

Mike,
Thanks for the screenshots. What colorscheme are you using? It
shouldn't matter in the GUI, but for a cterm, if the colorscheme
doesn't set the background color of the Normal group, Txtfmt has to
rely upon the Ignore group to hide the tokens. The Ignore group is one
of the Vim default groups, whose purpose is to conceal tokens;
however, some colorschemes define this group in such a way that tokens
are not hidden. This is described more fully in the Txtfmt help.
(:help txtfmt-cterm-ignore-issue) You can check to see whether your
colorscheme hides text in the Ignore group by doing...
:hi Ignore
...and checking to see whether the "xxx" is visible. Is Ignore text
visible to you?

Thanks,
Brett S.

>
> I'd really like to use your plugin, it looks great!
> - Mike
>
> --
> Entering the Ballardospherehttp://michaelmaurer.net/archives/2009/04/03/entering_the_ballardosph...

Michael Maurer

unread,
Apr 4, 2009, 6:03:15 PM4/4/09
to vim...@googlegroups.com
* Brett Stahlman <bretts...@comcast.net> [04.04.2009 22:32]:
>
> > > Thanks,

> > I don't know if it's the way my terminals are set up, or maybe I need to
> > compile vim with some extra optioni (latest stable with ruby support),
> > but I get this when I do
> > :MakeTestPage
> >
> > http://michaelmaurer.net/images/gnometerminal.pnghttp://michaelmaurer.net/images/xterm.png
> >
> > I put this in my .vimrc
> >
> > set t_Co=256
> > set term=gnome-256color
> >
> > but get no change (I dl'd the ncurses-term package you specified) .
>
> Mike,
> Thanks for the screenshots. What colorscheme are you using? It
> shouldn't matter in the GUI, but for a cterm, if the colorscheme
> doesn't set the background color of the Normal group, Txtfmt has to
> rely upon the Ignore group to hide the tokens. The Ignore group is one
> of the Vim default groups, whose purpose is to conceal tokens;
> however, some colorschemes define this group in such a way that tokens
> are not hidden. This is described more fully in the Txtfmt help.
> (:help txtfmt-cterm-ignore-issue) You can check to see whether your
> colorscheme hides text in the Ignore group by doing...
> :hi Ignore
> ...and checking to see whether the "xxx" is visible. Is Ignore text
> visible to you?
>
> Thanks,
> Brett S.
>

I tried :hi Ignore but got no results, :hi Ignore ctermfg=black did the
trick

http://michaelmaurer.net/images/gnometerm2.png
http://michaelmaurer.net/images/xterm2.png

But when you look at the gnome-terminal screenshot, you can still see the
fine lines of the chinese (?) characters inside the colored space.
Another problem is the fact that italic text doesn't get displayed. I've
tried switching fonts, but Monospace should be able to display this
anyway. rxvt-unicode displays everything alright, but gnome-terminal
should support unicode.. argh.

- Mike

--
"How I helped build the bomb that blew up Wall Street."
http://michaelmaurer.net/archives/2009/04/04/how_i_helped_build_the_bomb_that_blew_up_wall_street/index.html

Brett Stahlman

unread,
Apr 4, 2009, 6:53:56 PM4/4/09
to vim_use


On Apr 4, 5:03 pm, Michael Maurer <salogynso...@gmail.com> wrote:
> * Brett Stahlman <brettstahl...@comcast.net> [04.04.2009 22:32]:
>
>
>
>
>
> > > > Thanks,
> > > I don't know if it's the way my terminals are set up, or maybe I need to
> > > compile vim with some extra optioni (latest stable with ruby support),
> > > but I get this when I do
> > > :MakeTestPage
>
> > >http://michaelmaurer.net/images/gnometerminal.pnghttp://michaelmaurer...
>
> > > I put this in my .vimrc
>
> > > set t_Co=256
> > > set term=gnome-256color
>
> > > but get no change (I dl'd the ncurses-term package you specified) .
>
> > Mike,
> > Thanks for the screenshots. What colorscheme are you using? It
> > shouldn't matter in the GUI, but for a cterm, if the colorscheme
> > doesn't set the background color of the Normal group, Txtfmt has to
> > rely upon the Ignore group to hide the tokens. The Ignore group is one
> > of the Vim default groups, whose purpose is to conceal tokens;
> > however, some colorschemes define this group in such a way that tokens
> > are not hidden. This is described more fully in the Txtfmt help.
> > (:help txtfmt-cterm-ignore-issue) You can check to see whether your
> > colorscheme hides text in the Ignore group by doing...
> > :hi Ignore
> > ...and checking to see whether the "xxx" is visible. Is Ignore text
> > visible to you?
>
> > Thanks,
> > Brett S.
>
> I tried :hi Ignore but got no results, :hi Ignore ctermfg=black did the
> trick

The point of :hi Ignore was simply to let you see whether your
colorscheme hides text in the Ignore group. If it did, you wouldn't be
able to see the "xxx" output by the :hi Ignore command. Judging from
your initial screenshots, I'd guess that your colorscheme doesn't hide
Ignore'd text, but actually displays it as white or off-white on a
fairly dark background. One way to fix this would be to use a
colorscheme that hides Ignore text. About half of the distributed ones
do. If you like the colorscheme you're using, though, there are
several other possible solutions... You can figure out what the
background color is (sounds as though black is close, but not quite
right), then define the Ignore group ctermfg to match it. Another
possibility is to figure out what the Normal background color is and
set it explicitly before Txtfmt loads, like so...
:hi Normal ctermbg=black
When the Normal group's ctermbg has been set explicitly, Txtfmt
doesn't rely upon the Ignore group to hide tokens. Note, however, that
this works only if the Normal group's background color has been set
prior to the load of Txtfmt. (If you've already loaded Txtfmt, you can
simply use :Refresh to make Txtfmt take the new setting into account.)


>
> http://michaelmaurer.net/images/gnometerm2.pnghttp://michaelmaurer.net/images/xterm2.png
>
> But when you look at the gnome-terminal screenshot, you can still see the
> fine lines of the chinese (?) characters inside the colored space.
> Another problem is the fact that italic text doesn't get displayed. I've
> tried switching fonts, but Monospace should be able to display this
> anyway. rxvt-unicode displays everything alright, but gnome-terminal
> should support unicode.. argh.

I have noticed that some terminals (e.g gnome-terminal) don't display
italic properly. I'll investigate, but I don't believe there's
anything Txtfmt can do beyond ensuring that the Vim syntax region has
the italic attribute. Is the gnome-terminal the only one that displays
the remnants of the oriental looking characters?

Thanks,
Brett S.

>
> - Mike
>
> --
> "How I helped build the bomb that blew up Wall Street."http://michaelmaurer.net/archives/2009/04/04/how_i_helped_build_the_b...

Brett Stahlman

unread,
Apr 5, 2009, 9:21:02 AM4/5/09
to vim_use


On Apr 4, 5:53 pm, Brett Stahlman <brettstahl...@comcast.net> wrote:

...snip...
>
> I have noticed that some terminals (e.g gnome-terminal) don't display
> italic properly. I'll investigate, but I don't believe there's
> anything Txtfmt can do beyond ensuring that the Vim syntax region has
> the italic attribute. Is the gnome-terminal the only one that displays
> the remnants of the oriental looking characters?

I see that rxvt-unicode supports italic nicely. In fact, the Txtfmt
test page looks about as nice in a urxvt terminal as it does in the
GUI! I can't find any evidence that xterm is intended to support
italic. Bold, underline, inverse, blink, and even hidden, but not
italic. The xterm man page describes an option that suggests it might
be possible to have underline displayed as italic, but I'm not sure
that would help even if it worked, since it would force you to choose
between underline and italic. Gnome-terminal supports xterm control
sequences in addition to some VT220 extensions. VT220 doesn't appear
to have added an italic attribute. So it appears to me that rxvt-
unicode is the best of the 3 cterms I have on my system (at least from
a Txtfmt perspective). Does anyone know of other color terminals that
support italic?

Thanks,
Brett Stahlman

Benct Philip Jonsson

unread,
Apr 5, 2009, 10:21:51 AM4/5/09
to vim...@googlegroups.com
On 2009-04-04 Paris wrote:
> I tried editing with vim and then opening with open
> office writer coloring, italizing, bolding and saving to
> .doc. But it is painful! To much mouse work... select the
> text go press the stupid B or I button or go press font
> color and then red or green. Painful. I want to use my
> keybord and only my keyboard.
>

What you want is Ctrl-B and Ctrl-I inside Open Office
Writer, not a text editor.

If you find the whole business of writing in a WYSIWYG
word processor painful check out Pandoc.

<http://johnmacfarlane.net/pandoc/>

It can output rtf and odt format, which can be opened by
Open Office Writer. Then of course you can use vim to
produce markdown files, used as input to Pandoc.
I do it all the time!

/BP

Brett Stahlman

unread,
Apr 5, 2009, 11:30:27 AM4/5/09
to vim_use


On Apr 5, 9:21 am, Benct Philip Jonsson <b...@melroch.se> wrote:
> On 2009-04-04 Paris wrote:
> > I tried editing with vim and then opening with open
> > office writer coloring, italizing, bolding and saving to
> > .doc. But it is painful! To much mouse work... select the
> > text go press the stupid B or I button or go press font
> > color and then red or green. Painful. I want to use my
> > keybord and only my keyboard.
>
> What you want is Ctrl-B and Ctrl-I inside Open Office
> Writer, not a text editor.

I created Txtfmt precisely because I occasionally like the convenience
of WYSIWYG highlighting, but like to use Vim for all text editing. The
*current* version of Txtfmt supports customizable foreground colors,
in addition to bold, underline, italic, standout, reverse and
undercurl. Version 2.0 (coming soon) will support background colors as
well. With Txtfmt's customizable mappings (:help txtfmt-user-maps), it
is even possible to map things like Ctrl-B and Ctrl-I to do something
more complicated than simply begin a formatting region: e.g., you
could make these mappings embolden and center the current line or
italicize and redden the preceding word. Thus, for the simple type of
highlighting I would want in my text documents, there's really no
motivation to use anything other than Vim. Of course, if you're
formatting a textbook or something with lots of mathematical equations
or whatever, you probably want the power of something like Latex, but
for the types of documents many programmers keep, colors and
formatting attributes are often sufficient, and the WYSIWYG nature of
Txtfmt makes it (in my opinion) more convenient for this purpose than
something like Latex. Although I didn't look at Pandoc in detail, it
sounds as though you're talking about creating something in one editor
to be viewed in another. The point of Txtfmt is to permit you to view
the end result as you're typing it.

Brett Stahlman

Michael Maurer

unread,
Apr 5, 2009, 1:02:31 PM4/5/09
to vim...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* Paris <pari...@otenet.gr> [04.04.2009 00:03]:


>
> I tried editing with vim and then opening with open office writer
> coloring, italizing, bolding and saving to .doc. But it is painful! To
> much mouse work... select the text go press the stupid B or I button or
> go press font color and then red or green. Painful.
> I want to use my keybord and only my keyboard.

You could try using ViEmu

http://www.viemu.com/

It works for Word, Outlook and Visual Studio, allowing you to use
commands, motions, regex etc. just like in vim. Or so they say (never
used it) . I can feel your pain, I found myself in a similar situation
once. I made the switch to vim and LaTex, but still have to occasionally
use OOo when people send me stuff.

- - Mike

- --
How to sell, how to go bankrupt, how to shoot stuff
http://michaelmaurer.net/archives/2009/04/05/how_to_sell_how_to_go_bankrupt_how_to_shoot_stuff/index.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJ2OQmTXXWYTQ0StkRAm5UAJ9GQuawApGp+90cCqtBani0+QancQCfbVU+
025elev1zlkG0ZHkEsVQflo=
=UqCs
-----END PGP SIGNATURE-----

Michael Maurer

unread,
Apr 5, 2009, 1:07:59 PM4/5/09
to vim...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* Brett Stahlman <bretts...@comcast.net> [05.04.2009 00:55]:
> I have noticed that some terminals (e.g gnome-terminal) don't display
> italic properly. I'll investigate, but I don't believe there's
> anything Txtfmt can do beyond ensuring that the Vim syntax region has
> the italic attribute. Is the gnome-terminal the only one that displays
> the remnants of the oriental looking characters?

Yes, as far as I know. But I have to say it's not really a problem,
since I don't need the highlighting/italic-function anyway. The only
thing that's left for me to do is to customize the colors. I've got VIM
running inside of screen, which adds a layer of confusion/configuration.
BTW I'm using the default color scheme for Ubuntu Studio 8.04 together
with Tango.

- - Mike

>
> Thanks,
> Brett S.
>
> >
> > - Mike
> >
> > --
> > "How I helped build the bomb that blew up Wall Street."http://michaelmaurer.net/archives/2009/04/04/how_i_helped_build_the_b...
> >

- --
How to sell, how to go bankrupt, how to shoot stuff
http://michaelmaurer.net/archives/2009/04/05/how_to_sell_how_to_go_bankrupt_how_to_shoot_stuff/index.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJ2OVvTXXWYTQ0StkRAjYEAKCQIXcu4+qSZVwIwSBliQ+yFJ5ooACfZL6e
dgemEoM/hsePTouiV4dDCug=
=wOhH
-----END PGP SIGNATURE-----

Thomas Dickey

unread,
Apr 5, 2009, 4:09:43 PM4/5/09
to vim_use
On Apr 5, 9:21 am, Brett Stahlman <brettstahl...@comcast.net> wrote:
> I see that rxvt-unicode supports italic nicely. In fact, the Txtfmt
> test page looks about as nice in a urxvt terminal as it does in the
> GUI! I can't find any evidence thatxtermis intended to support
> italic. Bold, underline, inverse, blink, and even hidden, but not
> italic. Thextermman page describes an option that suggests it might
> be possible to have underline displayed as italic, but I'm not sure
> that would help even if it worked, since it would force you to choose
> between underline and italic. Gnome-terminal supportsxtermcontrol

gnome-terminal supports a subset of xterm's controls.
xterm's controls include vt220 controls.

> sequences in addition to some VT220 extensions. VT220 doesn't appear
> to have added an italic attribute. So it appears to me that rxvt-
> unicode is the best of the 3 cterms I have on my system (at least from
> a Txtfmt perspective). Does anyone know of other color terminals that
> support italic?

They'll be rare. The escape sequence you're referring to
was standardized in the early 1990s as a printer-specific control.
Neither curses nor slang support printer-controls like that.

--
Thomas E. Dickey <dic...@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

Stahlman Family

unread,
Apr 5, 2009, 4:38:49 PM4/5/09
to vim...@googlegroups.com


Michael Maurer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> * Brett Stahlman <bretts...@comcast.net> [05.04.2009 00:55]:
...snip...

Is the gnome-terminal the only one that displays the remnants of the
oriental looking characters?
>
> Yes, as far as I know. But I have to say it's not really a problem,
> since I don't need the highlighting/italic-function anyway. The only
> thing that's left for me to do is to customize the colors. I've got VIM
> running inside of screen, which adds a layer of confusion/configuration.
> BTW I'm using the default color scheme for Ubuntu Studio 8.04 together
> with Tango.

Sounds good. When you say "the default color scheme for Ubuntu Studio
8.04", I assume you're talking about the color scheme of the terminal
and not Vim's "colorscheme". If so, note that the colorscheme I was
referring to was the Vim colorscheme (selected with the :colorscheme
command). I believe the only colorschemes guaranteed always to hide
Ignore text (without your having to do an explicit :hi Ignore
ctermfg=<bgcolor>) are the ones that explicitly set ctermbg for the
Normal group. However, it sounds as though you've been able to fix the
issue for your colorscheme by setting Ignore ctermfg appropriately.
Incidentally, I'm glad to have found a terminal (urxvt) that properly
supports the italic attribute. I appreciate your feedback...

Brett S.

Stahlman Family

unread,
Apr 5, 2009, 4:42:20 PM4/5/09
to vim...@googlegroups.com


Thomas Dickey wrote:
> On Apr 5, 9:21 am, Brett Stahlman <brettstahl...@comcast.net> wrote:
>> I see that rxvt-unicode supports italic nicely. In fact, the Txtfmt
>> test page looks about as nice in a urxvt terminal as it does in the
>> GUI! I can't find any evidence thatxtermis intended to support
>> italic. Bold, underline, inverse, blink, and even hidden, but not
>> italic. Thextermman page describes an option that suggests it might
>> be possible to have underline displayed as italic, but I'm not sure
>> that would help even if it worked, since it would force you to choose
>> between underline and italic. Gnome-terminal supportsxtermcontrol
>
> gnome-terminal supports a subset of xterm's controls.
> xterm's controls include vt220 controls.

Ah yes. I see that now. I misread the gnome-terminal man page.

>
>> sequences in addition to some VT220 extensions. VT220 doesn't appear
>> to have added an italic attribute. So it appears to me that rxvt-
>> unicode is the best of the 3 cterms I have on my system (at least from
>> a Txtfmt perspective). Does anyone know of other color terminals that
>> support italic?
>
> They'll be rare. The escape sequence you're referring to
> was standardized in the early 1990s as a printer-specific control.
> Neither curses nor slang support printer-controls like that.

Thanks for the clarification. Unless I encounter some serious and
hitherto unnoticed limitations with urxvt, I may switch to it, as the
display looks very nice indeed.

Thanks,
Brett S.

Paris

unread,
Apr 5, 2009, 6:03:06 PM4/5/09
to vim...@googlegroups.com
The problem with Txtfmt is that I cannot have formated and unformated
text without space between them.

On Sun, 2009-04-05 at 08:30 -0700, Brett Stahlman wrote:
> I created Txtfmt precisely because I occasionally like the convenience
> of WYSIWYG highlighting, but like to use Vim for all text editing. The
> *current* version of Txtfmt supports customizable foreground colors,
> in addition to bold, underline, italic, standout, reverse and

> undercurl.........

Stahlman Family

unread,
Apr 5, 2009, 6:25:33 PM4/5/09
to vim...@googlegroups.com


Paris wrote:
> The problem with Txtfmt is that I cannot have formated and unformated
> text without space between them.

True, but in order to change this, I would need to make use of Vince
Negri's conceal patch. I have thought of doing this, but the problem is
that many Vim users are not comfortable with applying a patch. I may
look into making the functionality available as an option for those
willing to apply the patch...

Thanks,
Brett Stahlman

Paris

unread,
Apr 5, 2009, 7:36:11 PM4/5/09
to vim...@googlegroups.com
On Sun, 2009-04-05 at 17:25 -0500, Stahlman Family wrote:
> Paris wrote:
> > The problem with Txtfmt is that I cannot have formated and
> unformated
> > text without space between them.
>
> True, but in order to change this, I would need to make use of Vince
> Negri's conceal patch. I have thought of doing this, but the problem
> is
> that many Vim users are not comfortable with applying a patch. I may
> look into making the functionality available as an option for those
> willing to apply the patch...
>
> Thanks,
> Brett Stahlman

The thing is that I wanted to use it not for programming but for a
translation. So I cant have two spaces between a bold and italics word
and a non formated one.

Stahlman Family

unread,
Apr 5, 2009, 8:52:43 PM4/5/09
to vim...@googlegroups.com
Perhaps I've misunderstood your concern, but a single "bold-italic"
token appears as a single space, so I'm not sure why you would need an
actual space in addition to the bold-italic token. In other words,
there's no reason why the Txtfmt token can't simply replace the space
that would normally separate words.

Consider that...
WORD<SPACE>WORD
...in a normal buffer looks identical to...
WORD<BOLD_ITALIC_TOKEN>WORD
...in a Txtfmt buffer, except that the second word is bold-italic in the
Txtfmt buffer.

Brett S.

>
>
> >
>

Paris

unread,
Apr 6, 2009, 5:46:35 AM4/6/09
to vim...@googlegroups.com
On Sun, 2009-04-05 at 19:52 -0500, Stahlman Family wrote:
> Consider that...
> WORD<SPACE>WORD
> ...in a normal buffer looks identical to...
> WORD<BOLD_ITALIC_TOKEN>WORD
> ...in a Txtfmt buffer, except that the second word is bold-italic in
> the
> Txtfmt buffer.

Maybe I did something wrong because when I used \i fbi,cr and then
<ctrl-\><ctrl-\> f-,c- there were two or 3 spaces before and after the
formated word.
Anyway I must be able to have a red word followed by a non red
questionmark or a half red half nonformated word and with txtfmt I cant
do that. I 'm not saying txtfmt is not great, I'm just saying that I
cannot use it due to specific requirements.

Stahlman Family

unread,
Apr 6, 2009, 7:51:32 AM4/6/09
to vim...@googlegroups.com


Paris wrote:
> On Sun, 2009-04-05 at 19:52 -0500, Stahlman Family wrote:
>> Consider that...
>> WORD<SPACE>WORD
>> ...in a normal buffer looks identical to...
>> WORD<BOLD_ITALIC_TOKEN>WORD
>> ...in a Txtfmt buffer, except that the second word is bold-italic in
>> the
>> Txtfmt buffer.
>
> Maybe I did something wrong because when I used \i fbi,cr and then
> <ctrl-\><ctrl-\> f-,c- there were two or 3 spaces before and after the
> formated word.

For the example you showed, there would be exactly 2 Txtfmt characters
before and after the region. If a space already existed in either of
those locations, and you didn't want the appearance of 3 spaces, you
would need to delete the existing ones. Format-color combinations such
as this would benefit greatly from the conceal patch. The other example
you gave, mixed formats within a single word, although much less common,
would not even be feasible without the conceal patch. I'm thinking I may
look at what it would take to incorporate the "conceal" capability into
Txtfmt...

Thanks,
Brett S.

Paris

unread,
Apr 6, 2009, 8:05:05 AM4/6/09
to vim...@googlegroups.com
On Mon, 2009-04-06 at 06:51 -0500, Stahlman Family wrote:
> there would be exactly 2 Txtfmt characters
> before and after the region.

Yes you are right, I'm sorry. But there can be only one space between
words on a book or article etc

Michael Maurer

unread,
Apr 6, 2009, 11:44:28 AM4/6/09
to vim...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* Stahlman Family <bretts...@comcast.net> [05.04.2009 22:38]:

snip...

> Sounds good. When you say "the default color scheme for Ubuntu Studio
> 8.04", I assume you're talking about the color scheme of the terminal
> and not Vim's "colorscheme".

Ahh yes. I've put

colorscheme elflord
set background=dark

inside my vimrc and (nearly) everything works as advertised now. I say
"nearly" because every time I switch between screen-windows and back to
VIM, the underline-formatting gets lost. Italicize, bold and color seem
to work no matter what. But if I want to see the underlined text again,
I have to ctrl-f or ctrl-b. Something having to do with the terminal
getting redrawn? I have no clue. Could be related to gnome-terminal,
screen or both.

> Incidentally, I'm glad to have found a terminal (urxvt) that properly
> supports the italic attribute. I appreciate your feedback...

I appreciate you having written this, and for helping me set it up!
Together with the Universal-Text-Linking-plugin, this makes VIM into a
blazing fast Knowledge-Management-/Hyperlink-System.

Thanks,
Mike

>
> Brett S.

- --
How to sell, how to go bankrupt, how to shoot stuff
http://michaelmaurer.net/archives/2009/04/05/how_to_sell_how_to_go_bankrupt_how_to_shoot_stuff/index.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJ2iNcTXXWYTQ0StkRAkU6AJwNpCogvnyCU6kuPQnM8SvMslE1bgCfXeEJ
ocqkYVVK3UjLeSaQXmMLY8I=
=Lr3q
-----END PGP SIGNATURE-----

Brett Stahlman

unread,
Apr 6, 2009, 1:27:39 PM4/6/09
to vim_use


On Apr 6, 10:44 am, Michael Maurer <salogynso...@gmail.com> wrote:

snip...
>
> inside my vimrc and (nearly) everything works as advertised now. I say
> "nearly" because every time I switch between screen-windows and back to
> VIM, the underline-formatting gets lost. Italicize, bold and color seem
> to work no matter what. But if I want to see the underlined text again,
> I have to ctrl-f or ctrl-b. Something having to do with the terminal
> getting redrawn? I have no clue. Could be related to gnome-terminal,
> screen or both.

Whenever any type of highlighting becomes garbled, I hit <C-L> (Vim's
clear and redraw command). I haven't tried it with screen, but I would
expect it to work there as well.

>
> > Incidentally, I'm glad to have found a terminal (urxvt) that properly
> > supports the italic attribute. I appreciate your feedback...
>
> I appreciate you having written this, and for helping me set it up!
> Together with the Universal-Text-Linking-plugin, this makes VIM into a
> blazing fast Knowledge-Management-/Hyperlink-System.

It was my pleasure. UTL looks pretty powerful. I may give it a try
once I've finished adding background color and "conceal patch" support
to Txtfmt. Within my electronic, text-based journal, I often reference
other journal entries. It would be nice to have an actual link.

Thanks,
Brett S.

>
> Thanks,
> Mike
>
Reply all
Reply to author
Forward
0 new messages