Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting #137

Closed
gldtn opened this issue Oct 5, 2024 · 6 comments
Closed

Syntax highlighting #137

gldtn opened this issue Oct 5, 2024 · 6 comments
Labels
question Further information is requested

Comments

@gldtn
Copy link
Contributor

gldtn commented Oct 5, 2024

Question or Suggestion

I just noticed while I was playing with italics that my syntax highlighting is different from the original cyberdream for some reason:

Any idea what might be overriding? Or what I can check?
syntax

Thanks!

@gldtn gldtn added the question Further information is requested label Oct 5, 2024
@scottmckendry
Copy link
Owner

Hey @gldtn!

Can you be more specific about what is wrong? Nothing is jumping out at me from your screenshot.

@scottmckendry scottmckendry added the waiting for op This issue is waiting for a response from the original poster label Oct 5, 2024
@gldtn
Copy link
Contributor Author

gldtn commented Oct 5, 2024

Hey @gldtn!

Can you be more specific about what is wrong? Nothing is jumping out at me from your screenshot.

For example, the scopes(words in this case): local, require, @param, if, then, elseif, for, in, do, nvim_set_hl are all in white on my end, vs the screenshot from the readme you provided which is in orange.

Here I tried replicating it on this shot:
cyberdream

vs yours:
shot_original

@github-actions github-actions bot removed the waiting for op This issue is waiting for a response from the original poster label Oct 5, 2024
@scottmckendry
Copy link
Owner

ah! I see. are you using treesitter and have the lua parser installed?

@scottmckendry scottmckendry added the waiting for op This issue is waiting for a response from the original poster label Oct 5, 2024
@gldtn
Copy link
Contributor Author

gldtn commented Oct 5, 2024

Hmm, seems like there was a couple of things affecting, first my lame attempt to get .blade.php files to be parsed correctly:

After commenting this out, treesitter started parsing correctly..

-- -- FIXME: this is a hack to add blade support
		-- local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
		--
		-- ---@class ParserConfig
		-- parser_config.blade = {
		-- 	install_info = {
		-- 		url = "https://github.com/EmranMR/tree-sitter-blade",
		-- 		files = { "src/parser.c" },
		-- 		branch = "main",
		-- 	},
		-- 	filetype = "blade",
		-- }
		--
		-- vim.filetype.add({
		-- 	pattern = {
		-- 		[".*%.blade%.php"] = "blade",
		-- 	},
		-- })

Colors were also different due to me playing with italics:
cyberdream.lua

overrides = function(colours)
					return {
						-- italics
						Keyword = { italic = true },
						-- Constant = { italic = true },
						Function = { italic = true },
						Identifier = { italic = true },
						-- non-italics
						Unit = { italic = false },
						Error = { italic = false },
						Number = { italic = false },
					}
				end,

What is the proper way to add more italics to the theme without overriding the original colors?

@github-actions github-actions bot removed the waiting for op This issue is waiting for a response from the original poster label Oct 5, 2024
@scottmckendry
Copy link
Owner

scottmckendry commented Oct 5, 2024

The overrides function is intended to override the highlight group entirely, so you'd need to give it a colour otherwise it will just default to the value of fg.

So in this case, your config should look like this:

overrides = function(colours)
    return {
        -- italics
        Keyword = { fg = colours.orange, italic = true},
        Function = { fg = colours.blue, italic = true },
        -- and so on ...
    }
end,

That would be the way to do it inside the cyberdream config. However, a more simple approach in your case could be to set the italic property after cyberdream.nvim has already been set up. In that case, the following example should work:

return {
    {
        "scottmckendry/cyberdream.nvim",
        dev = true,
        lazy = false,
        priority = 1000,
        config = function()
            require("cyberdream").setup({})
            vim.cmd("colorscheme cyberdream")

            -- define italic groups
            local italic_groups = {
                "Keyword",
                "Function",
            }

            -- must appear AFTER the "colorscheme cyberdream" command
            for _, group in ipairs(italic_groups) do
                vim.cmd("hi " .. group .. " gui=italic cterm=italic")
            end
        end,
    },
}

@scottmckendry scottmckendry added the waiting for op This issue is waiting for a response from the original poster label Oct 5, 2024
@github-actions github-actions bot removed the waiting for op This issue is waiting for a response from the original poster label Oct 5, 2024
@scottmckendry scottmckendry added the waiting for op This issue is waiting for a response from the original poster label Oct 6, 2024
@gldtn
Copy link
Contributor Author

gldtn commented Oct 6, 2024

I do like that second approach, but that seems like it reverts the colors to the default Treesitter/LSP highlights. At least from the quick test I did here. So might have to go through :hi and match the ones I want to change. I ran into this issue here and being using fzf to discover all the highlights colors you set, thanks for the help as always!

@github-actions github-actions bot removed the waiting for op This issue is waiting for a response from the original poster label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants