Thursday, December 29, 2011

Re: weird highlighting when i edit java code

[reordered to bottom-posting standards]

On 29/12/11 17:19, Walkman wrote:
> On 2011.12.29., at 12:23, Rian Hunter<rian@thelig.ht> wrote:
>> hey all
>>
>> i seem to be getting weird behavior when editing java code and i'm not sure why. for some reason every time i have the word "register" in my source file it gets red highlighting. i just started using vim so i thought this was an error but my code seems to compile correctly. i've googled around but there is too much garbage in google when i search for "register vim java". i've been able to isolate and reproduce the problem, here's a screenshot:
>>
>> http://dl.dropbox.com/u/27498157/redhighlight.png
>>
>> am i missing something?
>>
>> rian
>>
> "register word highlighted in vim" first hit in google:
> http://vim.1045645.n5.nabble.com/Why-is-quot-template-quot-highlighted-in-Java-code-td1169135.html
>
> Sent from my iPad
>
>

Despite what is said in that archived discussion thread, my
$VIMRUNTIME/syntax/java.vim (official version dated 2010 March 23, found
in latest changeset of Bram's hg repository) includes the following at
lines 123-127:

> if !exists("java_allow_cpp_keywords")
> syn keyword javaError auto delete extern friend inline redeclared
> syn keyword javaError register signed sizeof struct template typedef union
> syn keyword javaError unsigned operator
> endif

so the default is to have all those highlighted as error; define that
variable (with any value) to remove that highlight.

The current help, however, says (syntax.txt lines 1606-1609):

> In order to help you write code that can be easily ported between Java and
> C++, all C++ keywords can be marked as an error in a Java program. To
> have this add this line in your .vimrc file: >
> :let java_allow_cpp_keywords = 0

which is the *opposite* of the current behaviour (actually, with that
variable undefined you get the highlight, and with it defined, even as
zero, the highlight is removed).


Best regards,
Tony.
--
There *is* intelligent life on Earth, but I leave for Texas on Monday.

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

No comments:

Post a Comment