Skip to content

Instantly share code, notes, and snippets.

View seandewar's full-sized avatar
🗿

Sean Dewar seandewar

🗿
View GitHub Profile
@seandewar
seandewar / eol-virt-foldable-region.lua
Created May 8, 2025 20:59
Nvim 0.10: A small indicator on the right side of the window that shows the size of the foldable region under the cursor.
local api = vim.api
local fn = vim.fn
local ns = api.nvim_create_namespace "conf_folding_virtual_text"
---@class ExtmarkInfo
---@field buf integer
---@field start_lnum integer
---@field end_lnum integer
---@field level integer
local funcs = {}
local function find_funcs(t, pre)
if pre == "vim.fn" or pre == "vim.loop" then
return
end
local function ident(name)
if not name:match "^[a-zA-Z_][a-zA-Z_0-9]*$" then
return ('%s["%s"]'):format(pre, name) -- I don't care about escaping.
end