From aa1efd58367066722daffdcbb198bfd8758f55b9 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sat, 19 Aug 2023 05:50:34 -0600 Subject: feat: add markdown hl and extra languages --- lua/plugins/hl-mdcodeblock.lua | 32 ++++++++++++++++++++++++++++++++ lua/plugins/treesitter.lua | 7 +++++++ 2 files changed, 39 insertions(+) create mode 100644 lua/plugins/hl-mdcodeblock.lua (limited to 'lua/plugins') diff --git a/lua/plugins/hl-mdcodeblock.lua b/lua/plugins/hl-mdcodeblock.lua new file mode 100644 index 0000000..3221678 --- /dev/null +++ b/lua/plugins/hl-mdcodeblock.lua @@ -0,0 +1,32 @@ +return { + 'yaocccc/nvim-hl-mdcodeblock.lua', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + require('hl-mdcodeblock').setup({ + hl_group = "MDCodeBlock", -- default highlight group + events = { -- refresh event + "FileChangedShellPost", + "Syntax", + "TextChanged", + "TextChangedI", + "InsertLeave", + "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 + '(fenced_code_block) @codeblock', -- query + }, + rmd = { -- filetype + 'markdown', -- parser + '(fenced_code_block) @codeblock', -- query + }, + }, + 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, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 7105fc0..d0bc8c5 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -8,12 +8,19 @@ return { -- as it has to be configured with the required...'.config' opts = { ensure_installed = { + 'bash', + 'ini', 'go', 'lua', 'python', 'typescript', 'vimdoc', 'vim', + 'css', + 'html', + 'markdown', + 'markdown_inline', + 'php' }, auto_install = false, highlight = { enable = true }, -- cgit v1.2.3-54-g00ecf