summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin
diff options
context:
space:
mode:
authorSenghan Bright <senghan.bright@deltaprojects.com>2020-11-23 11:07:53 +0100
committerGitHub <noreply@github.com>2020-11-23 11:07:53 +0100
commit124655608ff727ecee032bb2eb6f44014e8868eb (patch)
tree3cb4a1d5b67487da6e44bc943f171687e46b7c82 /lua/telescope/builtin
parent874139ee0b14fedfadca396884f166fc6eb34d4a (diff)
Register finder (#275)
builtin: Registers finder. view and edit vim registers.
Diffstat (limited to 'lua/telescope/builtin')
-rw-r--r--lua/telescope/builtin/init.lua34
1 files changed, 33 insertions, 1 deletions
diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua
index faef9d6..86055a2 100644
--- a/lua/telescope/builtin/init.lua
+++ b/lua/telescope/builtin/init.lua
@@ -788,7 +788,7 @@ builtin.man_pages = function(opts)
end
pickers.new(opts, {
- prompt_tile = 'Man',
+ prompt_title = 'Man',
finder = finders.new_table {
results = lines,
entry_maker = make_entry.gen_from_apropos(opts),
@@ -859,6 +859,38 @@ builtin.marks = function(opts)
}):find()
end
+builtin.registers = function(opts)
+ opts = opts or {}
+
+ local registers_table = {"\"", "_", "#", "=", "_", "/", "*", "+", ":", ".", "%"}
+
+ -- named
+ for i = 0, 9 do
+ table.insert(registers_table, tostring(i))
+ end
+
+ -- alphabetical
+ for i = 65, 90 do
+ table.insert(registers_table, string.char(i))
+ end
+
+ pickers.new(opts,{
+ prompt_title = 'Registers',
+ finder = finders.new_table {
+ results = registers_table,
+ entry_maker = make_entry.gen_from_registers(opts),
+ },
+ -- use levenshtein as n-gram doesn't support <2 char matches
+ sorter = sorters.get_levenshtein_sorter(),
+ attach_mappings = function(_, map)
+ map('i', '<CR>', actions.paste_register)
+ map('i', '<C-e>', actions.edit_register)
+
+ return true
+ end,
+ }):find()
+end
+
-- find normal mode mappings
builtin.keymaps = function(opts)
opts = opts or {}