Wednesday, June 2, 2010

Plug maps and insert mode problems

Hi all,
I am trying to pass some of my keymaps to use the <Plug> syntax. But I am having some problems when doing it in insert mode maps.
I have the next maps for word deleting in inser mode:
inoremap <C-BS> <C-w>
inoremap <C-Del> _<Esc>mzew<BS>i<Del><Esc>v`z"_c

And I am trying to substitu them with this:
  noremap <unique> <script> <silent> <Plug>TdvimWordBackspaceI <C-w>
  noremap <unique> <script> <silent> <Plug>TdvimWordDeleteI _<Esc>mzew<BS>i<Del><Esc>v`z"_c
  imap <C-BS> <Plug>TdvimWordBackspaceI
  imap <C-Del> <Plug>TdvimWordDeleteI

For the first imap command I always got the text <Plug>WordBackspaceI, is there any way to pass the <C-w> sequence in insert mode using the <Plug> syntax?
For the second I got something similar, but I have this workaround:
  noremap <unique> <script> <silent> <Plug>WordDeleteI mzew<BS>i<Del><Esc>v`z"_c
  imap <C-Del> _<Esc><Plug>WordDeleteI
But would be much better to have a more clean solution which dont need to have _<Esc> in fron of the Plug tag.
My idea is to have just the <Plug>TdvimActionName in the {lhs} of all my keymaps no matter the mode, to keep things clean and put all the code in the <Plug>TdvimActionName definition.

Thanks




--
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/2 Stahlman Family <brettstahlman@comcast.net>


Pablo Giménez wrote:
...[snip]...


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

Probably is this, because I was wondering why the italics doesn´t appear in
the terminal.
Yep it is trying to use bold italics.
The color scheme is CodeFactory:
http://www.vim.org/scripts/script.php?script_id=3079

Pablo,
I think I understand what's going on... If I'm correct, you are unable to hide the special characters because your terminal's default background color is black, but its "color palette" doesn't contain black. Note that in addition to the default "Text color" and "Background color", color terminals have what is known as a "Color palette". The colors in the color palette (also known as the color cube) are completely independent of the Text color and Background color. Vim's ctermfg/ctermbg mechanism works properly only for colors in the color palette: thus, setting ctermbg or ctermfg to the default Background color won't work unless the default Background color happens to be in the color palette. In other words, the workarounds will work only if the default background color is in the color palette.
Mmmm I am also using gnome-terminal and I have tried with both Linux console and Xterm Built-in schemes. both have black in the palette and the workaroundusing the autocommand is not working.
when I type:
:hi Ignore ctermfg=black
it works but not automatically using autocommands.
If I type  :au to get the list of all the autocommands I got this:
 colorStarted  ColorScheme
    *         hi Ignore ctermfg=black
              Refresh
So it seems that the command is properly registered and should be working. Is the same command I use from teh command line so it should be doing something.
And because the command works from the command line I suppose the terminal color palette has black.

I have attached a screenshot which shows the same text in gvim, gnome- terminal, and below xterm and gnome-termnial color settings.
Another problem seems to be the lack of italics support in my terminals both, gnome-terminal and xterm don't shpw italics characters.
I have been googling a little but there aren't too much help for this. In the gnome-terminal the only setting related to font style is enable/disable bold fonts. How do you enable italics in your terminals.
I am using Deja Vu Sans Mono as the font for gnome-terminal.

Finally as a temp workaround One thing I can do is to disable text formatting when a txtfmt file is opened in a non-gui environment and also if it would be possible delete the funny characters, but just in the buffer not in the file itself, it is possible?
This way no matter user's terminal settings you can offer a workaround, just disable any kind of formatting in your bufferm, and at least give something readable.

cheers and thanks for your help

I don't know what color terminal you're using, but I was able to reproduce what you were seeing in gnome-terminal. I was able to fix it by changing to a color palette that contained black...

On the gnome-terminal title bar...

Edit->Profile Preferences...

...brings up a dialog with multiple tabs. On the "Colors" tab, you can define the default foreground and background colors with the "Text color" and "Background color" color pickers. Under "Palette", there's a combo box that allows you to select from a number of built-in schemes. I was originally using "Tango", which had a couple different shades of grey, but no black. The others (Linux console, XTerm and Rxvt) all had black as the first color in the palette. After I had switched to "Linux console", the workarounds were successful...

Sincerely,

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: Unable to catch specific error [was: Re: delete lines from while loop]

[sorry for replying to myself]

On Mi, 02 iun 10, 11:32:03, Andrei Popescu wrote:
>
> fu! <SID>RemoveFuzzy() range
> execute ':''<,''>global/^#,\sfuzzy$\|^#|\s.*".*"$/d'
> for linenum in range(a:firstline, a:lastline)
> let line = getline(linenum)
> if line =~ '^#,\(.*,\)\=\s*fuzzy'
> call setline(linenum, substitute(line, ',\s*fuzzy', '', ""))
> endif
> endfor
> endf
>
> I tried (no pun intended) to replace the 'for' loop with:
>
> try
> execute ':''<,''>global/^#,\(.*,\)\=\s*fuzzy/s/,\s*fuzzy//'
> catch /^Vim\%((\a\+)\)\=:E486/ " based on example from :help catch
> endtry
>
> but I still get:
>
> E486: Pattern not found: ^#,\(.*,\)\=\s*fuzzy

Much simpler:

execute ':''<,''>s/,\s*fuzzy//e'

but I'm still curious why the :catch doesn't work...

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

Unable to catch specific error [was: Re: delete lines from while loop]

On Ma, 01 iun 10, 21:32:01, Tom Link wrote:
> >    for linenum in range(a:firstline, a:lastline)
>
> You might want to delete the lines in reverse order, i.e. from the
> bottom to the top.

Tried that, but couldn't find the right incantation, this is my first
try at vimscript ;)

> I also wonder if you could make use of the :g
> command.

Thanks a lot, :global is perfect! I'm hitting another issue now, with a
part of code not included so far (hence the subject change). Now I have:

fu! <SID>RemoveFuzzy() range
execute ':''<,''>global/^#,\sfuzzy$\|^#|\s.*".*"$/d'
for linenum in range(a:firstline, a:lastline)
let line = getline(linenum)
if line =~ '^#,\(.*,\)\=\s*fuzzy'
call setline(linenum, substitute(line, ',\s*fuzzy', '', ""))
endif
endfor
endf

I tried (no pun intended) to replace the 'for' loop with:

try
execute ':''<,''>global/^#,\(.*,\)\=\s*fuzzy/s/,\s*fuzzy//'
catch /^Vim\%((\a\+)\)\=:E486/ " based on example from :help catch
endtry

but I still get:

E486: Pattern not found: ^#,\(.*,\)\=\s*fuzzy

I can work around it by reversing the order, let the substitute global
do its work and then remove any '^#$' lines left behind in the deleting
global, but according to :help it should work.

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

Re: Progress indicator for :TOhtml command

On Wed, June 2, 2010 1:04 am, Benjamin Fritz wrote:
> - Added a second progress bar for the attributes processing (previously I
> was
> doing this with a %d/%d printf).
> 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?

Yes. I can't see the progressbar otherwise. It is not updating for me. So
I suggest, enabling it again.

regards,
Christian.

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

Tuesday, June 1, 2010

Re: delete lines from while loop

>    for linenum in range(a:firstline, a:lastline)

You might want to delete the lines in reverse order, i.e. from the
bottom to the top. I also wonder if you could make use of the :g
command.

Regards,
Tom

--
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:
...[snip]...

>> 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...)
>>
> Probably is this, because I was wondering why the italics doesn´t appear in
> the terminal.
> Yep it is trying to use bold italics.
> The color scheme is CodeFactory:
> http://www.vim.org/scripts/script.php?script_id=3079

Pablo,
I think I understand what's going on... If I'm correct, you are unable
to hide the special characters because your terminal's default
background color is black, but its "color palette" doesn't contain
black. Note that in addition to the default "Text color" and "Background
color", color terminals have what is known as a "Color palette". The
colors in the color palette (also known as the color cube) are
completely independent of the Text color and Background color. Vim's
ctermfg/ctermbg mechanism works properly only for colors in the color
palette: thus, setting ctermbg or ctermfg to the default Background
color won't work unless the default Background color happens to be in
the color palette. In other words, the workarounds will work only if the
default background color is in the color palette.

I don't know what color terminal you're using, but I was able to
reproduce what you were seeing in gnome-terminal. I was able to fix it
by changing to a color palette that contained black...

On the gnome-terminal title bar...

Edit->Profile Preferences...

...brings up a dialog with multiple tabs. On the "Colors" tab, you can
define the default foreground and background colors with the "Text
color" and "Background color" color pickers. Under "Palette", there's a
combo box that allows you to select from a number of built-in schemes. I
was originally using "Tango", which had a couple different shades of
grey, but no black. The others (Linux console, XTerm and Rxvt) all had
black as the first color in the palette. After I had switched to "Linux
console", the workarounds were successful...

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