Tuesday, June 1, 2010

Re: Formatting help files



2010/6/1 Stahlman Family <brettstahlman@comcast.net>


Pablo Giménez wrote:
2010/5/28 Stahlman Family <brettstahlman@comcast.net>

Pablo Giménez wrote:

Hi.
I have some help files along with my scripts and I wanto give them a
better
formatting.
So far the text layout is not too  bad, but I am wondering is there is
anyway to make some letter to appear as bold or italic, like when you
write
a wiki.
Is this possible with vim help files format????

Pablo,
You might have a look at the following plugin:

Txtfmt (The Vim Highlighter)
http://www.vim.org/scripts/script.php?script_id=2208

the plubing is really useful, thanks.
One question how I can use a foramting symbol just in the selected area in
viasual mode.
For instance I select some text in visual mode and then I want to apply a
bold format only to this area. There is any mapping that will enter the
prompt for format option apply them, and at the end of the selection add a
nonformat character?

Pablo,
I actually got quite far along toward the release of Txtfmt version 3.0, which adds visual map capability, before getting a bit sidetracked. The amount of user interest I've seen in this feature leads me to believe that it might be a good place to focus my efforts... In the meantime, note that Txtfmt provides a very powerful and flexible "User Map" feature, which allows you to create macros that combine Txtfmt operations (e.g., insert token/jump to token) with arbitrary Vim commands to perform complex sequences with just a keystroke or two.

:help txtfmt-user-maps

The mechanism is very powerful (and perhaps for that reason, a bit daunting to new users of the plugin); however, I've included a number of examples in the documentation, which should help to illustrate how it might be used. You might even be able to copy some of the examples to your .vimrc and use them as-is, or as a starting point for your own maps. If you get stuck, I'm always glad to help...

:help txtfmt-user-map-examples
These macros look a little bit weird for me at  the moment, I will try to find some time to study them.
thanks

Sincerely,
Brett Stahlman


cheers

Txtfmt can be used either as a standalone filetype, or in conjunction with
other filetypes (e.g., Vim "help"), to beautify your documents with word
processor style highlighting. Txtfmt allows you to create arbitrary regions
involving any combination of bold, underline, italic, etc..., as well as
both foreground and background colors. The following site contains
screenshots. (Note that there are multiple tabs in addition to "Home": the
"ywchaos", "Jnl and Txtfmt" and "ywtxt" tabs show Txtfmt regions
supplementing the statically-defined regions of other wiki/journal
filetypes.)

http://www.txtfmt.webs.com/

To use Txtfmt within a Vim help file, you would need to set the filetype to
help.txtfmt. One way to do this would be with the following modeline:

      vim:ft=help.txtfmt

If you decide to give it a try, there's a "Quick-Start Tutorial" on the
download page that explains how to add the highlighting regions. Let me know
if anything is unclear...

Sincerely,
Brett Stahlman



 thanks

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php





--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
Un saludo
Best Regards
Pablo Giménez

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Formatting help files



2010/6/1 Stahlman Family <brettstahlman@comcast.net>


Pablo Giménez wrote:
Hi Brett.
I am checking some text formatted with tftfmt in a terminal and for some
colorschemes the characters used to format the test appear visible in the
buffer.

Pablo,

The following section in the Txtfmt help gives a detailed explanation...

:help txtfmt-cterm-ignore-issue

...but the basic idea is this: for color terminals, when the background color is not known to Vim, Vim must rely upon the special "Ignore" highlight group to conceal the tokens. Note that the Ignore group was actually created in Vim6 precisely to allow special characters in help files to be hidden:

--From version6.txt--
"Ignore" highlight group: Text highlighted with this is made blank.  It is used to hide special characters in the help text.
---

For various reasons, however, some colorscheme authors have chosen to make the "Ignore" group quite visible. (Note that this is never an issue in the GUI where the background color is always known to Vim.) The Txtfmt help presents at least 3 workarounds for a cterm...

:help txtfmt-cterm-ignore-workaround
Well I found the autocomand solution should be the best for me.
I have the next in my vimrc:
 " Commands to be executed after the color scheme has been loaded
    augroup colorStarted
    if !has("gui_running")
        autocmd ColorScheme * hi Ignore ctermfg=black
    endif
    autocmd ColorScheme * Refresh
    augroup END

And unfortunately is not working, I have check the list of autocommands and everything looks ok, with the new commands for ColorScheme event, but is not working.
The one that refresh txtfmt after loading a colro  scheme works grat and now I can change my color scheme and get everything sync.
If the hi Ignore would work I think that the perfect solution should be to grab the background solor of the current colro scheme and use it as the colro for the Ignore group.
There is any way to know the background color of the current scheme???
cheers


Also if you change your current colorscheme in gvim the "format chatacters"
appears.
Is there any way to ensure that "format" characters will stay hidden always?

After changing your colorscheme, you should run...

:Refresh

...to get Txtfmt back in synch. This command can also be used when you have changed Txtfmt options and wish to have them take effect immediately (i.e., without restarting Vim or reloading the buffer).

Let me know if any of this is unclear...

Thanks,
Brett Stahlman


...[snip]...


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
Un saludo
Best Regards
Pablo Giménez

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Progress indicator for :TOhtml command

On Tue, 1 Jun 2010, Ben Fritz wrote:

> What did you do to see the slowdown?

In two separate Vim instances ("vim 2html.vim"--not at the same time):

:let timestart=join(reltime(), ' ') | exe 'so ' . expand('%') | let timefinish=join(reltime(), ' ')
:echo timestart | echo timefinish

Time elapsed about 39 seconds.

:let timestart=join(reltime(), ' ') | exe 'TOhtml' | let timefinish=join(reltime(), ' ')
:echo timestart | echo timefinish

Time elapsed about 31 seconds.

So the first is over 20% slower.

This morning I tried it under a "vim -u NONE --noplugin 2html.vim"
instance and your version was actually four seconds faster than the
original. Odd.

I do have a fairly complex vimrc, as well as a number of plugins
installed.

- Christian

--
Christian J. Robinson <heptite@gmail.com>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Progress indicator for :TOhtml command

On Jun 1, 7:21 am, Andy Wokula <anw...@yahoo.de> wrote:
>
> I'd suggest to try one of the existing progress bars (sorry,  didn't try
> them myself yet):
>
> http://github.com/tomtom/vimtlib/blob/master/autoload/tlib/progressba...http://www.vim.org/scripts/script.php?script_id=2006
>

Hmm, interesting...and thanks! These two plugins seem to use the
statusline for the progress indicator. I thought of that, and
abandoned the idea when I noticed that the status lines weren't being
populated all the way during processing...but later investigation
showed me that's because 'ruler' gets reset from one of the speed-up
options set by the plugin (I don't remember which). At the time, I was
still hoping to use :echon to output the progress indicator, which I
also had to abandon. My eventual goal is to use the full screen width
(or pretty close to it) for the progress bar. Is there a good way to
get this for an individual status line? I didn't think so, whereas
using an ":echo" type command, &columns basically does the trick.

I'll give it a shot using the status line (maybe making use of a
plugin, but I'm hoping for eventual inclusion into the upstream, so
maybe just pulling code from them). Hopefully it will be more usable.
For me, the screen flashes quite a bit *without* the progress
indicator, so I'm not certain it will be, but perhaps the somewhat
static status line will be more readable than a quickly flashing
message at the bottom of the window.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Progress indicator for :TOhtml command

On May 31, 11:11 pm, "Christian J. Robinson" <hept...@gmail.com>
wrote:
> On Tue, 1 Jun 2010, Yongwei Wu wrote:
> > I tried it on Windows, and the display was too flashy and intrusive.
> > I can't say I like it.


On May 31, 11:11 pm, "Christian J. Robinson" <hept...@gmail.com>
wrote:
> I would be for having a progress meter, if it could be implemented in
> a better way without slowing the script down.
>
> My best suggestion is just to output one line every 5 to 10 percent
> through processing with the current progress, e.g.:
>
>   0%
>   5%
>   10%
>   15%
>   [...]
>   95%
>   Done
>

Hmm, strange. I did not notice a slow-down from the original script,
but then I also set 'nomore' and fdm=manual as a way to speed things
up a little in addition to the progress bar changes. On my dinosaur of
a computer, processing 2html.vim took about 40 seconds LESS with the
patched version that with the unpatched version, according to the
before/after times returned by localtime(). What did you do to see the
slowdown?

I also dislike the flashiness, but couldn't find a way around it. The
echo'd text gets cleared every pass through the main processing loop.
For this reason, a periodic (5, 10, 20%, etc.) message wasn't going to
work. I would certainly prefer this method...my first attempt used
echon to display one "tick" every few lines processed (a tick being
calculated to almost fill the current &columns setting). Does someone
have an idea of how I might accomplish this?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Insert stdout of shell command on current line

On 10-06-01 07:55 AM, Andre Majorel wrote:
> Execute the current line (minus the leading "#") as a shell
> command and insert its output at +1, keeping the current line in
> place.
>
> Yp:.!sed 's/^\#//' | sh
>
> Is there a simpler way to do that ? Like a built-in command ?
>

Yes, they're called filters, see `:help filter`

Place the cursor on the line and type:

Ypx!!sh^M


--
Just my 0.00000002 million dollars worth,
Shawn

Programming is as much about organization and communication
as it is about coding.

The secret to great software: Fail early & often.

Eliminate software piracy: use only FLOSS.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Formatting help files

Pablo Giménez wrote:
> 2010/5/28 Stahlman Family <brettstahlman@comcast.net>
>
>> Pablo Giménez wrote:
>>
>>> Hi.
>>> I have some help files along with my scripts and I wanto give them a
>>> better
>>> formatting.
>>> So far the text layout is not too bad, but I am wondering is there is
>>> anyway to make some letter to appear as bold or italic, like when you
>>> write
>>> a wiki.
>>> Is this possible with vim help files format????
>>>
>> Pablo,
>> You might have a look at the following plugin:
>>
>> Txtfmt (The Vim Highlighter)
>> http://www.vim.org/scripts/script.php?script_id=2208
>>
> the plubing is really useful, thanks.
> One question how I can use a foramting symbol just in the selected area in
> viasual mode.
> For instance I select some text in visual mode and then I want to apply a
> bold format only to this area. There is any mapping that will enter the
> prompt for format option apply them, and at the end of the selection add a
> nonformat character?

Pablo,
I actually got quite far along toward the release of Txtfmt version 3.0,
which adds visual map capability, before getting a bit sidetracked. The
amount of user interest I've seen in this feature leads me to believe
that it might be a good place to focus my efforts... In the meantime,
note that Txtfmt provides a very powerful and flexible "User Map"
feature, which allows you to create macros that combine Txtfmt
operations (e.g., insert token/jump to token) with arbitrary Vim
commands to perform complex sequences with just a keystroke or two.

:help txtfmt-user-maps

The mechanism is very powerful (and perhaps for that reason, a bit
daunting to new users of the plugin); however, I've included a number of
examples in the documentation, which should help to illustrate how it
might be used. You might even be able to copy some of the examples to
your .vimrc and use them as-is, or as a starting point for your own
maps. If you get stuck, I'm always glad to help...

:help txtfmt-user-map-examples

Sincerely,
Brett Stahlman

> cheers
>
>> Txtfmt can be used either as a standalone filetype, or in conjunction with
>> other filetypes (e.g., Vim "help"), to beautify your documents with word
>> processor style highlighting. Txtfmt allows you to create arbitrary regions
>> involving any combination of bold, underline, italic, etc..., as well as
>> both foreground and background colors. The following site contains
>> screenshots. (Note that there are multiple tabs in addition to "Home": the
>> "ywchaos", "Jnl and Txtfmt" and "ywtxt" tabs show Txtfmt regions
>> supplementing the statically-defined regions of other wiki/journal
>> filetypes.)
>>
>> http://www.txtfmt.webs.com/
>>
>> To use Txtfmt within a Vim help file, you would need to set the filetype to
>> help.txtfmt. One way to do this would be with the following modeline:
>>
>> vim:ft=help.txtfmt
>>
>> If you decide to give it a try, there's a "Quick-Start Tutorial" on the
>> download page that explains how to add the highlighting regions. Let me know
>> if anything is unclear...
>>
>> Sincerely,
>> Brett Stahlman
>>
>>
>>
>> thanks
>>>
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>
>
>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php