summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 09c7d30..7c35699 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -169,4 +169,26 @@ function make_entry.gen_from_quickfix(opts)
end
end
+function make_entry.gen_from_buffer(opts)
+ return function(entry)
+ local bufnr_str = tostring(entry)
+ local bufname = vim.api.nvim_buf_get_name(entry)
+
+ if '' == bufname then
+ return nil
+ end
+
+ return {
+ valid = true,
+
+ value = bufname,
+ ordinal = bufnr_str .. " : " .. bufname,
+ display = bufnr_str .. " : " .. bufname,
+
+ bufnr = entry,
+ filename = bufname,
+ }
+ end
+end
+
return make_entry