Skip to content

A Neovim Plugin which uses Treesitter to conceal typical boiler Code

License

Notifications You must be signed in to change notification settings

Jxstxs/conceal.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

conceal.nvim

A Neovim Plugin which uses Tree-sitter to conceal typical boiler Code

TL;DR

  • Conceals Boiler Code with Tree-sitter
  • Keywords can be disabled (all Keywords are enabled by default)
  • Conceal Chars can be defined (defaults are given)
  • Highlight group can be defined (uses the default groups)

Demo

Installation

Using packer.nvim

use { "Jxstxs/conceal.nvim", requires = "nvim-treesitter/nvim-treesitter" }

Requirements

  • Neovim Nightly (v0.9.0-dev-124-gbd7ca10fd, the Version i Use)
  • nvim-treesitter

Usage/Examples

local conceal = require("conceal")

-- should be run before .generate_conceals to use user Configuration
conceal.setup({
    --[[ ["language"] = {
        enabled = bool,
        keywords = {
          ["keyword"] = {
              enabled     = bool,
              conceal     = string,
              highlight   = string
          }
        }
    } ]]
    ["lua"] = {
      enabled = true,
      keywords = {
        ["local"] = {
          enabled = false -- to disable concealing for "local"
        },
        ["return"] = {
          conceal = "R" -- to set the concealing to "R"
        },
        ["for"] = {
          highlight = "keyword" -- to set the Highlight group to "@keyword"
        }
      }
    },
    ["language"] = {
      enabled = false -- to disable the whole language
    }
})

-- generate the scm queries
-- only need to be run when the Configuration changes
conceal.generate_conceals()

-- bind a <leader>tc to toggle the concealing level
vim.keymap.set("n", "<leader>tc", function()
  require("conceal").toggle_conceal()
end, { silent = true})

Features

  • Conceal Boilerplate Code with a given Highlight group and conceal char
  • Function to toggle the Concealing Level

Contributing

Contributions are always welcome! Just remember to be Kind

License

This Project uses the MIT License, as mentioned here.

About

A Neovim Plugin which uses Treesitter to conceal typical boiler Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages