This Neovim plugin uses lines to indicate code folding areas and highlights the current fold.
![fold_line](https://private-user-images.githubusercontent.com/46311996/348207851-88ab809b-0de2-43df-b23a-e9dee7c0d30e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjI0NDIsIm5iZiI6MTczOTQyMjE0MiwicGF0aCI6Ii80NjMxMTk5Ni8zNDgyMDc4NTEtODhhYjgwOWItMGRlMi00M2RmLWIyM2EtZTlkZWU3YzBkMzBlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA0NDkwMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwYjMwMmQ1MGRlOWMyYjJiY2VlNGI0N2IzNzEwNmQ1ZjdmNGVkZDA5ZmMwNTY4MWJiOGY2OGJkODRiYTk0NjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.f7dBnx5j2P3_Cy4nclpg0b8oKPec1AYAaDSw5tTMdUA)
The line of the current fold is yellow. You can change the color by setting the FoldLineCurrent
highlight group.
Using lazy.nvim
-- init.lua:
{
"gh-liu/fold_line.nvim",
event = "VeryLazy",
init = function()
-- change the char of the line, see the `Appearance` section
vim.g.fold_line_char_open_start = "╭"
vim.g.fold_line_char_open_end = "╰"
end,
}
Use the highlight group FoldLine
to change the color of the line. Per default it links to Folded
.
And use the highlight group FoldLineCurrent
to change the color of the line of current fold. Per default it links to CursorLineFold
.
change the char of the line:
vim.g.fold_line_char_top_close = "+" -- default: fillchars.foldclose or "+"
vim.g.fold_line_char_close = "├" -- default: fillchars.vertright or "├"
vim.g.fold_line_char_open_sep = "│" -- default: fillchars.foldsep or "│"
vim.g.fold_line_char_open_start = "╭" -- default: "┌"
vim.g.fold_line_char_open_end = "╰" -- default: "└"
vim.g.fold_line_char_open_start_close = "╒" -- default: "╒"
vim.g.fold_line_char_open_end_close = "╘" -- default: "╘"
To show lines for the current fold only, set vim.g.fold_line_current_fold_only
to true
.
Set vim.g.fold_line_disable
(globally) or vim.w.fold_line_disable
(for a window) or vim.b.fold_line_disable
(for a buffer) to true
.