PotatoesMaster/i3-vim-syntax

Weirdness

Closed this issue · 4 comments

rafi commented

image

image

image

image

image

Hi,

The highlighting rules are a bit rough, as you can see. In fact it needs to be rewritten, but I didn't bother too much yet: I tried, but since the current syntax file works (kind of), it is much work for little gain.

But of course, any help on that would be appreciated. ;)

I try to keep track of the syntax changes (new keywords, etc. ; this is defined in commands.spec and config.spec there). Generating the syntax file from these would be awesome, but it doesn't seem easy neither.

Now, about the problems pointed:

  1. yes / no:

    The values 1, yes, true, on, enable and active are true, and the others are false. This is not defined in the *.spec files but directly in the code: config_directives.c:124.

    A line such as

    focus_follow_mouse do_not_want
    

    is correct and equivalent to

    focus_follow_mouse no
    

    I will add true that is missing, but the negatives are not keywords. I could add no, false, disable and inactive for now; consistency is not a bad thing.

  2. keywords highlighted in incorrect places:
    h, v, and x are keywords (used as arguments, for example in split v or floating_minimum_size 72 x 8). The highlighting is not much aware of the surrounding context, so the keywords are highlighted almost anywhere they appears. The workspace/container problem is really the same: workspace is highlighted as a command on its own and not as an argument. Again, fixing this would require a full rewrite of the syntax file.

rafi commented

Thanks for the great informative reply. I haven't learned Vim's syntax highlighting yet but I plan to. Hope to help with this some day, and it's great knowing you're keeping track with i3 spec and syntax. cheers!

rafi commented

Your recent changes helped reduce the weirdness, thanks :)

You're welcome! :)