dag / vim-fish

Vim support for editing fish scripts
MIT License
432 stars 59 forks source link

Not keyword is not highlighted #39

Closed karlek closed 6 years ago

karlek commented 7 years ago

dag/vim-fish out5958

fish, version 2.4.0 out9659

karlek commented 7 years ago

It looks like the fix is to add not to fishConditional here: https://github.com/dag/vim-fish/blob/825853f4816a07e59ea2ecee1190ab6a5d9ef991/syntax/fish.vim

dag commented 6 years ago

No, you'd have to put it in fishLineContinuation, which would mean it gets highlighted everywhere, as an argument to any command. Note that not gets highlighted correctly if it's on its own; problem is if works like sudo and other such commands that wrap other commands. Thus, not is technically just a string argument to if and it's technically correct not to highlight it as anything other than a string argument. You could make a special syntax rule for if but that gets hairy fast with Vim syntax rules, and tends to be slow. I decided against that for vim-fish.

dag commented 6 years ago

The other way to do it is to drop fishLineContinuation all-together and just make things like not keywords. But then a line like echo if begin function end highlights like a bunch of keywords, even though only echo was anything other than a string argument. I decided it was more helpful to ensure that nothing is incorrectly highlighted as a keyword, than to ensure that anything that possibly ever could be a keyword always gets highlighted as such.

karlek commented 6 years ago

Good conclusion. It's better to not highlight keywords incorrectly.