diff options
| author | Senghan Bright <senghan.bright@deltaprojects.com> | 2020-11-23 11:07:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-23 11:07:53 +0100 |
| commit | 124655608ff727ecee032bb2eb6f44014e8868eb (patch) | |
| tree | 3cb4a1d5b67487da6e44bc943f171687e46b7c82 /lua/telescope/make_entry.lua | |
| parent | 874139ee0b14fedfadca396884f166fc6eb34d4a (diff) | |
Register finder (#275)
builtin: Registers finder. view and edit vim registers.
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index e63fef2..aa1d3db 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -453,6 +453,33 @@ function make_entry.gen_from_marks(_) end end +function make_entry.gen_from_registers(_) + local displayer = entry_display.create { + separator = ":", + items = { + { width = 4 }, + { remaining = true }, + }, + } + + local make_display = function(entry) + return displayer { + string.format("[%s]", entry.value), + entry.content + } + end + + return function(entry) + return { + valid = true, + value = entry, + ordinal = entry, + content = vim.fn.getreg(entry), + display = make_display + } + end +end + function make_entry.gen_from_highlights() return function(entry) local make_display = function(entry) @@ -475,11 +502,13 @@ function make_entry.gen_from_highlights() ordinal = entry, preview_command = preview_command + } end end function make_entry.gen_from_vimoptions() + -- TODO: Can we just remove this from `options.lua`? function N_(s) return s @@ -546,7 +575,6 @@ function make_entry.gen_from_vimoptions() end end - -- TODO: don't call this 'line' local displayer = entry_display.create { separator = "│", items = { |
