wookayin / semshi

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

Install Differences for Lazy/Packer/etc? #8

Closed Normanras closed 12 months ago

Normanras commented 1 year ago

In keeping up with modern Neovim plugin managers, I tried installing this with Lazy which showed no errors until I opened a new python file. The SemshiBufOverwrite * command comes up as an error, so I wasn't sure if I did something in the setup. Anyone have any tips?

wookayin commented 1 year ago

I don't see SemshiBufOverwrite anywhere in the codebase. Can you please provide more specific information or error messages and/or steps to reproduce?

freohr commented 12 months ago

@Normanras After a bit of trial-and-error, here my basic config for loading Semshi with Lazy.nvim, it also includes call to nvim Lua api to change the highlight colors

  {
    "wookayin/semshi",
    ft = "python",
    build = ":UpdateRemotePlugins",
    config = function()
      vim.api.nvim_set_hl(0, "semshiLocal", { ctermfg=209, fg="#80aa9e" } )
      vim.api.nvim_set_hl(0, "semshiGlobal", { ctermfg=214, fg="#d3869b" } )
      vim.api.nvim_set_hl(0, "semshiImported", { ctermfg=214, fg="#8bba7f", cterm=bold, gui=bold } )
      vim.api.nvim_set_hl(0, "semshiParameter", { ctermfg=75,  fg="#8bba7f" } )
      vim.api.nvim_set_hl(0, "semshiParameterUnused", { ctermfg=117, fg="#34381b", cterm=underline, gui=underline} )
      vim.api.nvim_set_hl(0, "semshiFree", { ctermfg=218, fg="#e9b143"} )
      vim.api.nvim_set_hl(0, "semshiBuiltin", { ctermfg=207, fg="#f2594b"} )
      vim.api.nvim_set_hl(0, "semshiAttribute", { ctermfg=49,  fg="#3b4439"} )
      vim.api.nvim_set_hl(0, "semshiSelf", { ctermfg=249, fg="#db4740"} )
      vim.api.nvim_set_hl(0, "semshiUnresolved", { ctermfg=226, fg="#f28534", cterm=underline, gui=underline} )
      vim.api.nvim_set_hl(0, "semshiSelected", { ctermfg=231, fg="#ffffff", ctermbg=161, bg="#4c3432"} )

      vim.api.nvim_set_hl(0, "semshiErrorSign", { ctermfg=231, fg="#ffffff", ctermbg=160, bg="#402120"} )
      vim.api.nvim_set_hl(0, "semshiErrorChar", { ctermfg=231, fg="#ffffff", ctermbg=160, bg="#402120"} )
      vim.cmd([[sign define semshiError text=E> texthl=semshiErrorSign]])
    end
  }

The missing part, when i had the same error as you, was the build = ":UpdateRemotePlugins" and making sure that rplugin was not disabled in the Lazy base config (since I used AstroNvim intead of a bare Lazy config)

wookayin commented 12 months ago

Yes, Here's how I am lazy-loading semshi with lazy.nvim:

{
   'wookayin/semshi'
    ft = 'python',
    cond = has('python'),
    config = function()
      -- Semshi uses FileType autocmds on init. Have it called once again when lazy loaded.
      vim.cmd [[ doautocmd SemshiInit FileType python ]]
    end,
    build = ":UpdateRemotePlugins",
}

BTW Highlights are recommended to be set on a Colorscheme autocmd event, as suggested in README.

Closing this as OP seems to have no more problems. I will update README to provide installation instructions for lazy.nvim.

Normanras commented 12 months ago

Thanks! Yes, good to close. I'll be testing this out soon. Appreciate your help!