summaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2024-01-13 05:51:40 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2024-01-13 05:51:40 -0600
commita6cae467b7cd24f1e98be8098ac156f76c0e4f13 (patch)
treed54850720515f668c640d670a561abab886f5f8f /lua/plugins
parent17fb84781bbce51c40c4f89fc250dd00d55e4d9f (diff)
feat: add RGB colorizer support
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/colorizer.lua35
-rw-r--r--lua/plugins/hl-mdcodeblock.lua20
2 files changed, 45 insertions, 10 deletions
diff --git a/lua/plugins/colorizer.lua b/lua/plugins/colorizer.lua
new file mode 100644
index 0000000..f676278
--- /dev/null
+++ b/lua/plugins/colorizer.lua
@@ -0,0 +1,35 @@
+return {
+ 'NvChad/nvim-colorizer.lua',
+ opts = {
+ filetypes = { '*' },
+ user_default_options = {
+ RGB = true, -- #RGB hex codes
+ RRGGBB = true, -- #RRGGBB hex codes
+ names = true, -- "Name" codes like Blue or blue
+ RRGGBBAA = false, -- #RRGGBBAA hex codes
+ AARRGGBB = false, -- 0xAARRGGBB hex codes
+ rgb_fn = false, -- CSS rgb() and rgba() functions
+ hsl_fn = false, -- CSS hsl() and hsla() functions
+ css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
+ css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
+ -- Available modes for `mode`: foreground, background, virtualtext
+ mode = 'background', -- Set the display mode.
+ -- Available methods are false / true / "normal" / "lsp" / "both"
+ -- True is same as normal
+ tailwind = false, -- Enable tailwind colors
+ -- parsers can contain values used in |user_default_options|
+ sass = { enable = false, parsers = { 'css' }, }, -- Enable sass colors
+ virtualtext = '■',
+ -- update color values even if buffer is not focused
+ -- example use: cmp_menu, cmp_docs
+ always_update = false,
+ },
+ -- all the sub-options of filetypes apply to buftypes
+ buftypes = {},
+ },
+ config = function(_, opts)
+ require('colorizer').setup(opts)
+
+ vim.keymap.set('n', '<leader>ct', '<CMD>ColorizerToggle<CR>', { desc = '[C]olorizer [T]oggle' })
+ end
+}
diff --git a/lua/plugins/hl-mdcodeblock.lua b/lua/plugins/hl-mdcodeblock.lua
index 3221678..b7bd7f3 100644
--- a/lua/plugins/hl-mdcodeblock.lua
+++ b/lua/plugins/hl-mdcodeblock.lua
@@ -3,8 +3,8 @@ return {
dependencies = { 'nvim-treesitter/nvim-treesitter' },
config = function()
require('hl-mdcodeblock').setup({
- hl_group = "MDCodeBlock", -- default highlight group
- events = { -- refresh event
+ hl_group = "MDCodeBlock", -- default highlight group
+ events = { -- refresh event
"FileChangedShellPost",
"Syntax",
"TextChanged",
@@ -13,19 +13,19 @@ return {
"WinScrolled",
"BufEnter",
},
- padding_right = 4, -- always append 4 space at lineend
- timer_delay = 20, -- refresh delay(ms)
- query_by_ft = { -- special parser query by filetype
- markdown = { -- filetype
- 'markdown', -- parser
+ padding_right = 4, -- always append 4 space at lineend
+ timer_delay = 20, -- refresh delay(ms)
+ query_by_ft = { -- special parser query by filetype
+ markdown = { -- filetype
+ 'markdown', -- parser
'(fenced_code_block) @codeblock', -- query
},
- rmd = { -- filetype
- 'markdown', -- parser
+ rmd = { -- filetype
+ 'markdown', -- parser
'(fenced_code_block) @codeblock', -- query
},
},
- minumum_len = 100, -- minimum len to highlight (number | function)
+ minumum_len = 100, -- minimum len to highlight (number | function)
-- minumum_len = function () return math.max(math.floor(vim.api.nvim_win_get_width(0) * 0.8), 100) end
})
end,