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

135004Re: vim syntax highlighting: why the long underline ?

Expand Messages
  • Robin Kaup
    Dec 12, 2012
    • 0 Attachment
      On 12 December 2012 20:33, Khaled Ahsan Talukder <khaled.ahsan.talukder@...> wrote:
      Hi Robin,

      Thanks for the help. However, I am extremely novice in vim scripting. But my vim.c file seem to be working fine, which I did not noticed before, so the snapshot was a bit misleading -- where I have written c++ code in a java file, sorry for that.

      The problem I am having with is java, it shows a long underline in the "switch-case" statement under the "default" keyword. I am attaching the $VIMRUNTIME/syntax/java.vim file, which came as default with the gvim 7.2.330 installation in my Ubuntu machine. 

      Thanks again.


      On Wed, Dec 12, 2012 at 10:24 AM, Robin Kaup <k.robin64@...> wrote:


      On 12 December 2012 15:16, Robin Kaup <k.robin64@...> wrote:
      On 12 December 2012 06:28, ramgorur <khaled.ahsan.talukder@...> wrote:
      Hi,

      In my vim syntax highlighting, I am having a long underline under certain keywords. Please see the snapshot here -- http://i.stack.imgur.com/HufRs.png

      Thanks in advance.

      --
      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
       
      Looks like you have a regex matching the start of lines with "^". Is this the C++ syntax highlighting that comes with Vim? I suppose whoever wrote it didn't anticipate someone using underlines in their color schemes. You could work around it by changing your color scheme to not underline at all.


      Had a look in my $VIMRUNTIME/syntax/c.vim. These seem to be the offending lines:

      syn cluster cLabelGroup contains=cUserLabel
      syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
      syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup
      syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
      syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup

      The syntax highlighter is probably matching the "^\s*" before your labels. Perhaps someone can think of a better regex for this? I can't.

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



      --
      ------------------------------------------------------
      Department of Computer Science and Engineering (CSE)
      Islamic University of Technology (IUT)
      Board Bazar, Gazipur - 1704, Bangladesh
      Email: akmkat@...
      Phone: +88-02-9291254~9 Ext. 3223

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

      So it's:

      syn region  javaLabelRegion     transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter
      syn match   javaUserLabel       "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel
      syn keyword javaLabel default

      I tried removing '^\s*' from that second line, and with that your example code looked right. But it must be there for a reason. I suggest you submit a bug report so that someone who knows what they're doing can fix this -- assuming it hasn't already been reported already.

      --
      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
    • Show all 6 messages in this topic