summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
authorSenghan Bright <senghan.bright@deltaprojects.com>2020-12-02 00:27:54 +0100
committerGitHub <noreply@github.com>2020-12-02 00:27:54 +0100
commit8546fdf610584c367f0f1e105aedec370d71bf54 (patch)
tree6d57d1fd4882655b64bb26b363f4667ce56458b9 /lua/telescope/make_entry.lua
parentb1d436ce9247b13b83590652d905e45749a0bdd5 (diff)
new builtin - autocommands (#302)
* feat: new builtin - Autocommands finder * fix: remove decorators to avoid confusion. * make preview split same hl-group as border * use highlight instead of marker character for preview selection hl
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 2a4ae5c..e1389d4 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -682,4 +682,42 @@ function make_entry.gen_from_ctags(opts)
end
end
+function make_entry.gen_from_autocommands(_)
+ local displayer = entry_display.create {
+ separator = "▏",
+ items = {
+ { width = 14 },
+ { width = 18 },
+ { width = 16 },
+ { remaining = true },
+ },
+ }
+
+ local make_display = function(entry)
+ return displayer {
+ entry.event,
+ entry.group,
+ entry.ft_pattern,
+ entry.command
+ }
+ end
+
+ -- TODO: <action> dump current filtered items to buffer
+ return function(entry)
+ return {
+ event = entry.event,
+ group = entry.group,
+ ft_pattern = entry.ft_pattern,
+ command = entry.command,
+ value = string.format("+%d %s", entry.source_lnum, entry.source_file),
+ source_file = entry.source_file,
+ source_lnum = entry.source_lnum,
+ --
+ valid = true,
+ ordinal = entry.event .. " " .. entry.group .. " " .. entry.ft_pattern .. " " .. entry.command,
+ display = make_display,
+ }
+ end
+end
+
return make_entry