LiadOz / nvim-dap-repl-highlights

Add syntax highlighting to the nvim-dap REPL
110 stars 6 forks source link

How to install this using lazy.nvim ? #12

Open linux-root opened 3 months ago

LiadOz commented 3 months ago

Here is my configuration for treesitter, which includes nvim-dap-repl-highlights config:

{
  'nvim-treesitter/nvim-treesitter',
  event = { "BufReadPost", "BufNewFile" },
  dependencies = {
    "nvim-treesitter/nvim-treesitter-context"
  },
  config = function()
    require('nvim-dap-repl-highlights').setup() -- must be setup before nvim-treesitter
    require('nvim-treesitter.configs').setup {
      highlight = {
        enable = true,
        disable = function(_, buf)
          local max_filesize = 100 * 1024 -- 100 KB
          local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
          if ok and stats and stats.size > max_filesize then
            return true
          end
        end
      },
      indent = {
        enable = true,
        disable = {}
      },
      ensure_installed = {
        "bash",
        "luadoc",
        "json",
        "markdown",
        "regex",
        "vim",
        "vimdoc",
        "lua",
        "python",
        "typescript",
        "html",
        "javascript",
        'tsx',
        'scss',
        "rust",
        "c",
        "dap_repl",
        "yaml",
      },
    }
    vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
  end
}
linux-root commented 3 months ago

Here is my configuration for treesitter, which includes nvim-dap-repl-highlights config:

{
  'nvim-treesitter/nvim-treesitter',
  event = { "BufReadPost", "BufNewFile" },
  dependencies = {
    "nvim-treesitter/nvim-treesitter-context"
  },
  config = function()
    require('nvim-dap-repl-highlights').setup() -- must be setup before nvim-treesitter
    require('nvim-treesitter.configs').setup {
      highlight = {
        enable = true,
        disable = function(_, buf)
          local max_filesize = 100 * 1024 -- 100 KB
          local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
          if ok and stats and stats.size > max_filesize then
            return true
          end
        end
      },
      indent = {
        enable = true,
        disable = {}
      },
      ensure_installed = {
        "bash",
        "luadoc",
        "json",
        "markdown",
        "regex",
        "vim",
        "vimdoc",
        "lua",
        "python",
        "typescript",
        "html",
        "javascript",
        'tsx',
        'scss',
        "rust",
        "c",
        "dap_repl",
        "yaml",
      },
    }
    vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
  end
}

Awesome! btw, I think the nvim-dap-repl-highlights must be included as a tree-sitter's dependency as well :

 dependencies = {
    "nvim-treesitter/nvim-treesitter-context",
    "LiadOz/nvim-dap-repl-highlights",
  },

It would be great if you could put this as a config example using lazy.nvim to REAME.md, so the beginners like me can onboard this awesome plugin easily. Thank you!