inline-fold.nvim
is a Neovim plugin inspired by the vscode plugin inline-fold
. It provides a convenient way to define patterns in files that get concealed inline. This can be used for many things for example for CSS classes in HTML files especially with TailwindCSS
Note: It doesn't work for multiline patterns.
- Toggle folding of the content
- Replace the folded content with a placeholder for improved readability.
- Placeholder can be defined by the user per pattern
- pattern can be easily added
Use your preferred plugin manager to install inline-fold.nvim
.
{
"malbertzard/inline-fold.nvim",
opts = {
defaultPlaceholder = "…",
queries = {
-- Some examples you can use
html = {
{ pattern = 'class="([^"]*)"', placeholder = "@" }, -- classes in html
{ pattern = 'href="(.-)"' }, -- hrefs in html
{ pattern = 'src="(.-)"' }, -- HTML img src attribute
}
},
}
}
Once installed, the plugin provides the following functionality:
InlineFoldToggle
: Toggles the folding of the content within CSS class attributes.
Add the following snippet to your configurations to call InlineFoldToggle
automatically based on filename patterns.
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
pattern = { '*.html', '*.tsx' },
callback = function(_)
if not require('inline-fold.module').isHidden then
vim.cmd('InlineFoldToggle')
end
end,
})
- Check if moving to Treesitter is viable
- Create some sub commands for updating and removing conceals
- Record showcase
This project is licensed under the MIT License.