1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00
jdhao-nvim-config/lua/config/nvim-statuscol.lua
jdhao f1062a3d8f filter fold level sign for statuscol.nvim
Only show fold signs for fold level below a certain level to avoid
clutter the left side columns with a lot of folding signs
2024-08-07 00:14:19 +08:00

24 lines
636 B
Lua

local builtin = require("statuscol.builtin")
local ffi = require("statuscol.ffidef")
local C = ffi.C
-- only show fold level up to this level
local fold_level_limit = 2
local function foldfunc(args)
local foldinfo = C.fold_info(args.wp, args.lnum)
if foldinfo.level > fold_level_limit then
return " "
end
return builtin.foldfunc(args)
end
require("statuscol").setup {
relculright = false,
segments = {
{ text = { "%s" }, click = "v:lua.ScSa" },
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
{ text = { foldfunc, " " }, condition = { true, builtin.not_empty }, click = "v:lua.ScFa" },
},
}