Command highlighting color not used
Hi, I have my fish shell to use different colors for keywords and commands, but in this plugin, builtin commands are being colored as keywords.
Per the fish documentation:
-
fish_color_command: commands like echo -
fish_color_keyword: keywords like if - this falls back on the command color if unset
I have the following in my local fish color scheme:
" Grey commands
hi fish_color_command ctermfg=DarkGrey guifg=#808080
" Purple keywords
hi fish_color_end ctermfg=DarkMagenta guifg=#8959a8
hi fish_color_keyword ctermfg=DarkMagenta guifg=#8959a8
Here is a small comparison to show the difference (ignore the background on the left, that is from the solarized theme I otherwise use on vim):
It might be a little hard to see, but the fish output (on the right) has commands test, echo, and set_color in grey, whereas in the vim output (on the left) has those in keyword purple.
Looking at the source, it appears that the plugin considers terms like test, echo, and set_color to be keywords, whereas fish considers them to be commands (builtins):
syn keyword fishKeyword _ abbr argparse begin bg bind block break breakpoint cd commandline
\ complete continue count disown echo emit eval exec exit false fg function functions
\ history jobs math printf pwd random read realpath return set set_color source status
\ string test time true type ulimit wait
\ skipwhite nextgroup=@fishNext
For what it's worth, the fish Commands documentation lists the following keywords:
if, for, while, break, continue, function, return, begin, end, and, or, not, switch, case, command, builtin, time, and exec.
The rest, like test, echo, and set_color mentioned above, are considered builtins.
That would reduce the above line to:
syn keyword fishKeyword begin break continue exec function return time skipwhite nextgroup=@fishNext
And with that change in my local copy, the output now matches fish output!
As a suggestion, perhaps builtins should be a separate category in the plugin so they could be colored as keywords or commands as per the user's preference. Though I am guessing most people use the defaults where keyword color = command color.
Thanks for flagging this. I usually have the keyword and command group set to the same color so I hadn't noticed that builtins are highlighted as commands instead of keywords.
I've removed all of the builtin commands from fishKeyword in the latest commit.
I'm hesitant to add a new syntax group for builtins since this isn't a thing in fish, but I might be able to make an intermediate group that links to fishCommand by default. I'll play around with it and see what works.