A Neovim Plugin which uses Tree-sitter to conceal typical boiler Code
- 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)
Using packer.nvim
use { "Jxstxs/conceal.nvim", requires = "nvim-treesitter/nvim-treesitter" }
- Neovim Nightly (v0.9.0-dev-124-gbd7ca10fd, the Version i Use)
- nvim-treesitter
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})
- Conceal Boilerplate Code with a given Highlight group and conceal char
- Function to toggle the Concealing Level
Contributions are always welcome! Just remember to be Kind
This Project uses the MIT License, as mentioned here.