Loading ...
Sorry, an error occurred while loading the content.
 

Re: Formatting help files

Expand Messages
  • Pablo Giménez
    2010/6/1 Brett Stahlman ... Yep it is, the autocommand doesn t change the foreground color for the special characters to black.
    Message 1 of 32 , Jun 1, 2010
      2010/6/1 Brett Stahlman <brettstahlman@...>


      On Jun 1, 11:37 am, Pablo Giménez <pablog...@...> wrote:
      > 2010/6/1 Stahlman Family <brettstahl...@...>
      >
      >
      >
      >
      >
      >
      >
      > > 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
    • Brett Stahlman
      ... No problem. Glad to hear it works for you. Looks like you ve come up with a good approach. Let me know if you have any other issues... Sincerely, Brett
      Message 32 of 32 , Jun 9, 2010
        On Jun 8, 9:33 am, Pablo Giménez <pablog...@...> wrote:
        > Perfecto working liek a  charm.
        > Thanks
        > I have put this in my after/ftplugin/txtfmt.vim
        >
        > " Disable txtfmt formating if we aren't in gui mode
        > if !has("gui_running")
        >     call tdvim#StripTxtfmtTokens("help")
        > endif
        >
        > " Enable refresh if coor scheme changes:
        > autocmd ColorScheme <buffer> :Refresh
        >
        > Which seems to work nice.
        > Thansk for your help!

        No problem. Glad to hear it works for you. Looks like you've come up
        with a good approach. Let me know if you have any other issues...

        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
      Your message has been successfully submitted and would be delivered to recipients shortly.