summaryrefslogtreecommitdiff
path: root/lua/plugins/hl-mdcodeblock.lua
blob: b7bd7f3e5161837902220e28cc91283946101fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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,
}