princejoogie / tailwind-highlight.nvim

Highlight Tailwind CSS classes in neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tailwind-highlight.nvim

License Version

Highlight Tailwind CSS classes in neovim

"The neovim plugin used by a Netflix Engineer (@trash_dev)"

tailwind-highlight-demo

Installation

  • Packer

    -- required dependency
    use "neovim/nvim-lspconfig"
    -- (optional) for installing tailwindcss language server
    use "williamboman/nvim-lsp-installer"
    
    use "princejoogie/tailwind-highlight.nvim"
  • Vim Plug

    " required dependency
    Plug 'neovim/nvim-lspconfig'
    " (optional) for installing tailwindcss language server
    Plug 'williamboman/nvim-lsp-installer'
    
    Plug 'princejoogie/tailwind-highlight.nvim'

Usage

local tw_highlight = require('tailwind-highlight')

Without Lsp Installer

Manually install tailwindcss-language-server

require('lspconfig').tailwindcss.setup({
  on_attach = function(client, bufnr)
    -- rest of you config
    tw_highlight.setup(client, bufnr, {
      single_column = false,
      mode = 'background',
      debounce = 200,
    })
  end
})

With Lsp Installer

:LspInstall tailwindcss

require('nvim-lsp-installer').on_server_ready(function(server)
  local opts = {
    on_attach = function(client, bufnr)
      -- rest of you config
      tw_highlight.setup(client, bufnr, {
        single_column = false,
        mode = 'background',
        debounce = 200,
      })
    end
  }

  server:setup(opts)
end)

Methods

Method Args Returns
setup (client, bufnr, opts) void
ping N/A string

Setup Options

Option Description Default
single_column highlight only first character false
mode highlight mode foreground | background background
debounce delay on updating highlights (ms) 200

Like the project? would appreciate a coffee ☕

Buy Me A Coffee

Contributor list

Contributors


Made with ☕ by Prince Carlo Juguilon

About

Highlight Tailwind CSS classes in neovim

License:Other


Languages

Language:Lua 100.0%