wookayin / semshi

🌈 Semantic Highlighting for Python in Neovim
79 stars 5 forks source link

option to specify number and string colors? #18

Open Alan-Manning opened 11 months ago

Alan-Manning commented 11 months ago

Hello,

how could i have the functionality to change the double quoted string, number/floats etc aswell. i dont mind if this is not added to the plugin, probably not everybody would want this. It would be nice to have a way of setting this though even if i have to add some code to my local semshi.vim file. What i really would like is the below colors in the setup somehow: image

-- python -- Normal text: #ddedff -- comment: #5a83a4 -- String: #00c8ff -- Number: #fbff00 -- keywords: #ee00ff -- Builtin: #fabc02 -- Defonitions: #88e63c -- Instances: #ff3b18

this is the code i have atm to setup the plugin with lazy if that helps anybody.

return {
    "wookayin/semshi",
    ft = "python",
    build = ":UpdateRemotePlugins",
    version = "*", -- Recommended to use the latest release
    init = function() -- example, skip if you're OK with the default config
        vim.g["semshi#error_sign"] = true
        vim.g["semshi#excluded_hl_groups"] = {}
    end,
    config = function()
        -- python
        -- Normal text: #ddedff
        -- comment: #5a83a4
        -- String: #00c8ff
        -- Number: #fbff00
        -- keywords: #ee00ff
        -- Builtin: #fabc02
        -- Defonitions: #88e63c
        -- Instances: #ff3b18

        -- Setting up an autogroup and autocmd.
        local semshi_custom_highlights = vim.api.nvim_create_augroup("lint", { clear = true })

        vim.api.nvim_create_autocmd(
            { "BufEnter" },
            {
                pattern = { "*.py" },
                group = semshi_custom_highlights,
                callback = function()
                    vim.cmd([[highlight semshiGlobal          ctermfg=214 guifg=#BBDBFF]])
                    vim.cmd([[highlight semshiImported        ctermfg=214 guifg=#ddedff]])
                    vim.cmd([[highlight semshiParameter       ctermfg=117 guifg=#BBDBFF]])
                    vim.cmd([[highlight semshiParameterUnused ctermfg=75  guifg=#5fafff cterm=underline gui=underline]])
                    vim.cmd([[highlight semshiFree            ctermfg=218 guifg=#ffafd7]])
                    vim.cmd([[highlight semshiBuiltin         ctermfg=207 guifg=#fabc02]])
                    vim.cmd([[highlight semshiAttribute       ctermfg=49  guifg=#9BCAF9]])
                    vim.cmd([[highlight semshiSelf            ctermfg=249 guifg=#ff3b18]])
                    vim.cmd([[highlight semshiUnresolved      ctermfg=226 guifg=#ffff00 cterm=underline gui=underline]])
                    vim.cmd([[highlight semshiSelected        ctermfg=231 guifg=#ffffff ctermbg=161 guibg=#1a72bb]])

                    vim.cmd([[highlight semshiErrorSign       ctermfg=231 guifg=#ffffff ctermbg=160 guibg=#d70000]])
                    vim.cmd([[highlight semshiErrorChar       ctermfg=231 guifg=#ffffff ctermbg=160 guibg=#d70000]])
                end,
            }
        )

  end,
}
wookayin commented 10 months ago

Aren't regex-based vim syntax or treesitter highlight not enough for you? Semshi was not designed to provide basic highlights for python.

Alan-Manning commented 10 months ago

i am using the default regex hi atm because treesitter was very slow on large python files, lagging every couple of seconds. But this means that is the same for every filetype and ideally i would like that for jsut python. I wasnt sure if this was something that could easily be extended to include this so all the python highlighting is done from one place.

wookayin commented 10 months ago

Regex based vim syntax can also highlight numbers and strings, no?

Alan-Manning commented 10 months ago

it can yes but i would like it different for different filetypes so wondered if this was possible through this.