fold_line.nvim
August 6, 2026 · View on GitHub
This Neovim plugin uses lines to indicate code folding areas and highlights the current fold.
Screenshots
The line of the current fold is yellow. You can change the color by setting the FoldLineCurrent highlight group.
Installation
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,
}
Appearance
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: "╘"
Virtual text priority
Set the extmark priority before the plugin loads:
vim.g.fold_line_char_priority = 100 -- default: 100
The current fold uses this value plus one so that it takes precedence over other fold lines. Lower the value if fold lines overwrite diagnostics or virtual text from other plugins; raise it if fold lines should take precedence instead.
Current fold only
To show lines for the current fold only, set vim.g.fold_line_current_fold_only to true.
Bar position strategy
The “bar” is the rendered character (for example │, ┌, └) drawn via virtual text.
You can control how its screen column is computed via fold_line_bar_pos_strategy:
- buffer-local:
vim.b.fold_line_bar_pos_strategy - window-local:
vim.w.fold_line_bar_pos_strategy - global:
vim.g.fold_line_bar_pos_strategy
Priority: b: > w: > g: > default.
vim.g.fold_line_bar_pos_strategy = "indent": align bars to (fold start) indentation (legacy behavior).vim.g.fold_line_bar_pos_strategy = "level": align bars by fold level (fixed step per level, like a foldcolumn).vim.g.fold_line_bar_pos_strategy = "hybrid": prefer"indent", but auto-degrade to"level"when foldmethod isexpr/syntax(where indentation is often not meaningful).
If unset, it defaults to "hybrid".
Disabling
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.