rktjmp / lush.nvim

Create Neovim themes with real-time feedback, export anywhere.
MIT License
1.47k stars 48 forks source link

Cannot add colour variation for filetype sh #128

Closed JoshuaCrewe closed 1 year ago

JoshuaCrewe commented 1 year ago

When editing an .env file I can't seem to set overrides based on file type. The filetype for an .env is sh for which I have the following override :

    sym("@constant.sh")    { fg = 'Red' },

2023-05-17_10-28

If I change the filetype and the override to javascript then it works fine :

    sym("@constant.javascript")    { fg = 'Red' },

2023-05-17_10-35

It looks like the sh override isn't working but I could be doing something wrong.

rktjmp commented 1 year ago

Check :hi @constant.sh to check the rules look as you expect, otherwise this will be a filetype/treesitter/nvim issue not Lush. Also be sure some other file isn't clobbering your setup.

JoshuaCrewe commented 1 year ago

@rktjmp :hi @constant.sh does return the value I would expect :

2023-05-17_15-10

it isn't applying it which means that ... I am actually not sure what this means. Something else is clobbering it? :set ft? does come back with sh but perhaps it uses something else to define what the file is and which overrides to apply?

rktjmp commented 1 year ago

I'm not sure how you'd inspect it, but perhaps .env isn't actually applying the sh treesitter parser? I'm not sure if setting the ft=sh is enough to actually "load and run sh treesitter to this file" or not?

I had a look here https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries and could not see sh, only bash, fish, etc. Have you tried ft=bash?

However it goes, it looks to me like its applying @constant, so it is never setting your X= to "constant as found by the sh parser" or whatever, as far as I can tell.

JoshuaCrewe commented 1 year ago

@rktjmp bingo.

    sym("@constant.bash")    { fg = 'Red' },

That works. TIL filetype != treesitter parser (thing)

Thanks so much for your input I learned a lot!