Tuesday, June 1, 2010

Re: Progress indicator for :TOhtml command

>
> Here is an experimental version, in which I included the essential part
> from the mentioned vim.org/script into the script from Ben.
>
> Bugs: - currently only works well with a big enough window.
> - progressbar requires redrawing the window, while processing
> the 2html.vim script. This means, it slows it down.
> - requires a +float (no check yet)
>

I like this look a lot better! I made a few improvements:

- Change the color of StatusLineNC to match StatusLine (and restore it at the
end) to reduce flashing of the statusline.
- Draw the progress bar in the new window instead of the original window, to
reduce the amout of time from the screen clear to the redraw when redrawing
the windows, reducing the flashing effect.
- Set the size of the new window to only 2 lines, so that only 1 line of the
buffer actually appears. The intent of this was to further reduce the flashing
effect, but it also has the nice side affect of making the conversion MUCH
faster, since less of the expensive html syntax highlighting needs to be
completed every redraw.
- Added a second progress bar for the attributes processing (previously I was
doing this with a %d/%d printf).
- Fixed bug in progress bar incr function that prevented incrementing by large
amounts, that are still less than the maximum value.
- Fixed bug where progress bar would not fill all the way when doing non-dynamic
folds.
- Fixed off-by-one error in progress bar initialization.

I also removed the "redrawstatus" commands. They did not seem to be necessary,
and only served to increase the processing time. Did you have a particular
reason to include them?

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

...[snip]...
> > > And unfortunately is not working,
>
> > Pablo,
> > Do you mean that hi Ignore ctermfg=black does not change the
> > foreground color of the tokens to black? What happens if you
> > execute...
> > hi Ignore ctermfg=black
> > ...in a standard Vim help buffer? You will get "E421: Color name or
> > number not recognized" if the specified color is not supported by your
> > cterm. Or were you simply saying that black is not always the correct
> > background color?
>
>  Yep it is, the autocommand doesn't change the foreground color for the
> special characters to black.
> Also the background is black for the whole screen except for those words
> affected by the formating, which apperars with a grey background.
> I have attached a screenshot (I dont know if the list allows to attach
> files).
> If I execute the command from the command line the characters dissapears but
> the background is still grey rather than black.
> And yes, I am using a help file type, this is the modeline I am using:
> vim:tw=78:ts=8:ft=help.txtfmt:norl:

Pablo,
Thanks for the screenshot. I'll check into it tonight when I have
access to a real terminal on my Linux system at home. Do you mind
telling me what colorscheme and terminal you're using? Also, what type
of region is being applied to the text with the grey background (e.g.,
"TDVIM USER MANUAL")? (I'm guessing it's bold-italic, and you're using
a color terminal that doesn't really support italic, but displays it
as reverse video instead...)

>
>
>
>
>
>
>
> > > 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???
>
> > With the GUI, the background color is always known by Vim: thus, no
> > workaround is required for any colorscheme, since the plugin can
> > always do this:
>
> > :hi Ignore ctermfg=bg
>
> If you do this using a color scheme that doesn't define the background color
> you got an error.
> Any to detect if my current colorscheme is defining the background color, so
> I can use bg if it is defined or black otherwise .

Well, you could parse the output of...
:hi Normal
...but note that if your colorscheme defines the Normal background
color, you shouldn't have to do anything special; the plugin should
handle it...

Sincerely,
Brett Stahlman

> cheers
>
>
>
>
>
>
>
> > With a cterm, however, Vim has no way of knowing the background color
> > unless the colorscheme sets the Normal background color explicitly:
> > e.g.,
>
> > :hi Normal ctermbg=<some_color>
>
> > Some of the colorschemes contain this sort of explicit set of Normal
> > background color, but many simply leave it at the terminal's default.
> > If you want to use such a colorscheme in a color terminal, you will
> > have to determine the correct background color through visual
> > inspection. Having done that, you can either set the Ignore group's
> > ctermfg to match the observed background color (workaround #1) or
> > explicitly set the Normal group's ctermbg to match the observed
> > background color (workaround #2). Unfortunately, the plugin can't
> > determine the background color automatically, since Vim itself doesn't
> > know...
>
> > Thanks,
> > Brett S.
>
> > > 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, visithttp://www.vim.org/maillist.php
>
> > > --
> > > Un saludo
> > > Best Regards
> > > Pablo Giménez- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > 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, visithttp://www.vim.org/maillist.php
>
> --
> Un saludo
> Best Regards
> Pablo Giménez- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

--
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: delete lines from while loop

On Lu, 31 mai 10, 23:09:58, Christian Brabandt wrote:
> Hi Andrei!
>
> I am not sure, I understand your problem. Anyway, your function has one
> problem. You are deleting lines (including the end-of-line), so you
> after the exe "normal! dd" command your file has actually one line less
> then before. And the next time you run getline(linenum) you get actually
> the wrong line. (which would now be equivalent to linenum+1 and each
> time you do normal! dd you add another one)

Thanks, I have rewritten the function like this:

fu! <SID>RemoveFuzzy() range
for linenum in range(a:firstline, a:lastline)
let line = getline(linenum)
if line =~ '^#,\sfuzzy$'
let startline = linenum
let endline = linenum
elseif line =~ '^#|\s.*".*"$'
let endline = endline + 1
endif
endfor
exe startline.",".endline."d"
endf

This works because .po files have a strict format I can rely on, but I
have a feeling it could be shorter...

Regards,
Andrei
--
http://nuvreauspam.ro/2010/05/4-neticheta-pe-mail/

Re: Issue with Vim copy paste

On 01/06/10 13:46, Ajay Jain wrote:
> Hi,
>
> I am using facing issues while doing copy and paste from vim. I am
> using cygwin xterm and then ssh to remote host and then opening vim.
>
> The copy and paste from Vim to my local machine is not working
> properly. Can somebody please give me checklist on what to enable in
> default so that copy paste works between vim and any local windows
> application.
>
> Many thanks in advance,
> Ajay.
>

Please read http://www.catb.org/~esr/faqs/smart-questions.html
attentively, then explain in more detail what you mean by "is not
working properly": what are you doing? (step-by-step); what is
happening? what did you expect to happen?


Best regards,
Tony.
--
Money is the root of all evil, and man needs roots

--
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 Brett Stahlman <brettstahlman@comcast.net>


On Jun 1, 11:37 am, Pablo Giménez <pablog...@gmail.com> wrote:
> 2010/6/1 Stahlman Family <brettstahl...@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,

Pablo,
Do you mean that hi Ignore ctermfg=black does not change the
foreground color of the tokens to black? What happens if you
execute...
hi Ignore ctermfg=black
...in a standard Vim help buffer? You will get "E421: Color name or
number not recognized" if the specified color is not supported by your
cterm. Or were you simply saying that black is not always the correct
background color?
 Yep it is, the autocommand doesn't change the foreground color for the special characters to black.
Also the background is black for the whole screen except for those words affected by the formating, which apperars with a grey background.
I have attached a screenshot (I dont know if the list allows to attach files).
If I execute the command from the command line the characters dissapears but the background is still grey rather than black.
And yes, I am using a help file type, this is the modeline I am using:
vim:tw=78:ts=8:ft=help.txtfmt:norl:

> 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???

With the GUI, the background color is always known by Vim: thus, no
workaround is required for any colorscheme, since the plugin can
always do this:

:hi Ignore ctermfg=bg
If you do this using a color scheme that doesn't define the background color you got an error.
Any to detect if my current colorscheme is defining the background color, so I can use bg if it is defined or black otherwise .
cheers

With a cterm, however, Vim has no way of knowing the background color
unless the colorscheme sets the Normal background color explicitly:
e.g.,

:hi Normal ctermbg=<some_color>

Some of the colorschemes contain this sort of explicit set of Normal
background color, but many simply leave it at the terminal's default.
If you want to use such a colorscheme in a color terminal, you will
have to determine the correct background color through visual
inspection. Having done that, you can either set the Ignore group's
ctermfg to match the observed background color (workaround #1) or
explicitly set the Normal group's ctermbg to match the observed
background color (workaround #2). Unfortunately, the plugin can't
determine the background color automatically, since Vim itself doesn't
know...

Thanks,
Brett S.


> 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, visithttp://www.vim.org/maillist.php
>
> --
> Un saludo
> Best Regards
> Pablo Giménez- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

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

On Jun 1, 11:42 am, Pablo Giménez <pablog...@gmail.com> wrote:
> 2010/6/1 Stahlman Family <brettstahl...@comcast.net>
>
>
>
>
...[snip]...

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

Understood. I should probably get back to work on the visual
maps... ;-)

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

Re: Formatting help files

On Jun 1, 11:37 am, Pablo Giménez <pablog...@gmail.com> wrote:
> 2010/6/1 Stahlman Family <brettstahl...@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,

Pablo,
Do you mean that hi Ignore ctermfg=black does not change the
foreground color of the tokens to black? What happens if you
execute...
hi Ignore ctermfg=black
...in a standard Vim help buffer? You will get "E421: Color name or
number not recognized" if the specified color is not supported by your
cterm. Or were you simply saying that black is not always the correct
background color?

> 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???

With the GUI, the background color is always known by Vim: thus, no
workaround is required for any colorscheme, since the plugin can
always do this:

:hi Ignore ctermfg=bg

With a cterm, however, Vim has no way of knowing the background color
unless the colorscheme sets the Normal background color explicitly:
e.g.,

:hi Normal ctermbg=<some_color>

Some of the colorschemes contain this sort of explicit set of Normal
background color, but many simply leave it at the terminal's default.
If you want to use such a colorscheme in a color terminal, you will
have to determine the correct background color through visual
inspection. Having done that, you can either set the Ignore group's
ctermfg to match the observed background color (workaround #1) or
explicitly set the Normal group's ctermbg to match the observed
background color (workaround #2). Unfortunately, the plugin can't
determine the background color automatically, since Vim itself doesn't
know...

Thanks,
Brett S.


> 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, visithttp://www.vim.org/maillist.php
>
> --
> Un saludo
> Best Regards
> Pablo Giménez- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

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