Warning
This plugin is under construction.
Neovim CSS Intellisense for HTML
- HTML
id
andclass
attribute completion. - Supports linked and
internal
style sheets. - Supports additional
external
style sheets.
return require("lazy").setup({
{
"hrsh7th/nvim-cmp",
dependencies = {
"Jezda1337/nvim-html-css" -- add it as dependencies of `nvim-cmp` or standalone plugin
},
opts = {
sources = {
{
name = "html-css",
option = {
enable_on = { "html" }, -- html is enabled by default
notify = false,
documentation = {
auto_show = true, -- show documentation on select
},
-- add any external scss like one below
style_sheets = {
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
"https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css",
},
},
},
},
},
},
})
option = {
enable_on = { "html" },
notify = false,
documentation = {
auto_show = true,
},
style_sheets = {}
}
Setting the formatter this way, you will get the file name with an extension in your cmp menu, so you know from which file that class is coming.
require("cmp").setup({
-- ...
formatting = {
format = function(entry, vim_item)
if source == "html-css" then
source_mapping["html-css"] = "[" .. entry.completion_item.provider .. "]" or "[html-css]"
end
return vim_item
end
}
-- ...
})