From ba57d6ea45891ba9c089399343352a307ff3ffc5 Mon Sep 17 00:00:00 2001 From: Jules Sang Date: Wed, 4 Oct 2023 22:09:03 +0200 Subject: [PATCH] Inline-fold --- lua/config/autocmds.lua | 12 ++++++------ lua/plugins/inline-fold.lua | 22 ++++++++++++++++++++++ lua/plugins/nvim-colorizer.lua | 11 ++++++++++- 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 lua/plugins/inline-fold.lua diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 8a9a186..7134bf8 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -2,9 +2,9 @@ -- Default autocmds that are always set: https://github.com/jul-o/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here --- vim.api.nvim_create_autocmd({ "BufWritePre" }, { --- group = vim.api.nvim_create_augroup("format_on_save", {}), --- callback = function() --- vim.lsp.buf.format() --- end, --- }) +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.html", "*.tsx", "*.jsx" }, + callback = function(_) + vim.cmd("InlineFoldActivate") + end, +}) diff --git a/lua/plugins/inline-fold.lua b/lua/plugins/inline-fold.lua new file mode 100644 index 0000000..e0bb6d5 --- /dev/null +++ b/lua/plugins/inline-fold.lua @@ -0,0 +1,22 @@ +local tsx = { + { pattern = 'className="([^"]*)"' }, -- classes in html +} + +local jsx = tsx + +return { + "malbertzard/inline-fold.nvim", + opts = { + defaultPlaceholder = "…", + queries = { + html = { + { pattern = 'class="([^"]*)"' }, -- classes in html + { pattern = 'className="([^"]*)"' }, -- classes in html + { pattern = 'href="(.-)"' }, -- hrefs in html + { pattern = 'src="(.-)"' }, -- HTML img src attribute + }, + typescriptreact = tsx, + javascriptreact = jsx, + }, + }, +} diff --git a/lua/plugins/nvim-colorizer.lua b/lua/plugins/nvim-colorizer.lua index 5b7d6dc..3049be5 100644 --- a/lua/plugins/nvim-colorizer.lua +++ b/lua/plugins/nvim-colorizer.lua @@ -2,7 +2,16 @@ return { "NvChad/nvim-colorizer.lua", config = function() require("colorizer").setup({ - tailwind = true, + user_default_options = { + tailwind = true, + RRGGBBAA = true, -- #RRGGBBAA hex codes + AARRGGBB = true, -- 0xAARRGGBB hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, + sass = { enable = true, parsers = { "css" } }, + }, }) end, }