razak17 / tailwind-fold.nvim

Neovim plugin to conceal long class attributes.
48 stars 7 forks source link

Tailwind-fold.nvim

Neovim plugin to conceal long class attributes.

Requirements

Requires nvim-treesitter

Installation

Using lazy.nvim in lua

{
  'razak17/tailwind-fold.nvim',
  opts= {},
  dependencies = { 'nvim-treesitter/nvim-treesitter' },
  ft = { 'html', 'svelte', 'astro', 'vue', 'typescriptreact', 'php', 'blade' },
},

Using vim-plug in vimscript

call plug#begin()
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'razak17/tailwind-fold.nvim'
(...)
call plug#end()

lua << EOF
  require("tailwind-fiold").setup {
    ft = { 'html', 'svelte', 'astro', 'vue', 'typescriptreact', 'php', 'blade' },
  }
EOF
return {
    'razak17/tailwind-fold.nvim',
    opts = {},
    dependencies = {'nvim-treesitter/nvim-treesitter'},
    event = "VeryLazy",
    config = function()
        require('tailwind-fold').setup({ft = {'html', 'twig'}})
    end
}

Showcase

2023-05-11_202341_699860995

Default Options

{
    enabled = true,
    ft = {
        "html",
        "svelte",
        "astro",
        "vue",
        "tsx",
        "php",
        "blade",
        "eruby",
    }
},

Configuration

:TSInstall html
:set conceallevel=2
:set concealcursor=

Usage

The plugin is activated automatically

:TailwindFoldDisable, :TailwindFoldEnable and :TailwindFoldToggle are also available to change fold state.

Development and Contributions

Feel free to open and issue or create a PR if a filetype you are using is not supported yet.

Resources and Acknowledgements

All credit goes to the author of this gist, which made the initial version of this plugin possible.

You can use it if you prefer not to install a plugin