summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
authorWeihang Lo <weihanglo@users.noreply.github.com>2021-04-15 21:26:38 +0800
committerGitHub <noreply@github.com>2021-04-15 09:26:38 -0400
commit9e603d3c1b947c8f063d81a3c926e216b708928f (patch)
treebe557f52e77e2443a6eb261166f0bfb445d3b208 /lua/telescope/make_entry.lua
parent2e7ee55aa44306dc5a6a47946559d10d4fe360db (diff)
feat: table layout for builtin commands (#754)
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index b9635bb..02d9ca1 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -1019,6 +1019,48 @@ function make_entry.gen_from_autocommands(_)
end
end
+function make_entry.gen_from_commands(_)
+ local displayer = entry_display.create {
+ separator = "▏",
+ items = {
+ { width = 25 },
+ { width = 4 },
+ { width = 4 },
+ { width = 11 },
+ { remaining = true },
+ },
+ }
+
+ local make_display = function(entry)
+ local attrs = ""
+ if entry.bang then attrs = attrs .. "!" end
+ if entry.bar then attrs = attrs .. "|" end
+ if entry.register then attrs = attrs .. '"' end
+ return displayer {
+ {entry.name, "TelescopeResultsIdentifier"},
+ attrs,
+ entry.nargs,
+ entry.complete or "",
+ entry.definition,
+ }
+ end
+
+ return function(entry)
+ return {
+ name = entry.name,
+ bang = entry.bang,
+ nargs = entry.nargs,
+ complete = entry.complete,
+ definition = entry.definition,
+ --
+ value = entry,
+ valid = true,
+ ordinal = entry.name,
+ display = make_display,
+ }
+ end
+end
+
local git_icon_defaults = {
added = "+",
changed = "~",