Skip to content

Instantly share code, notes, and snippets.

@seandewar
Created July 31, 2025 15:06
Show Gist options
  • Select an option

  • Save seandewar/222834e0e214e815a86d93893c53ced8 to your computer and use it in GitHub Desktop.

Select an option

Save seandewar/222834e0e214e815a86d93893c53ced8 to your computer and use it in GitHub Desktop.
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
return ("%s.%s"):format(pre, name)
end
for k, v in pairs(t) do
k = tostring(k)
if not k:match "^_" then
if type(v) == "table" then
find_funcs(v, ident(k))
elseif type(v) == "function" then
table.insert(funcs, ident(k) .. "()")
end
end
end
end
find_funcs(vim, "vim")
table.sort(funcs)
vim.cmd.tabnew()
vim.api.nvim_buf_set_lines(0, 0, -1, true, funcs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment