mirror of
https://github.com/zoriya/telescope.nvim.git
synced 2026-08-16 02:45:09 +00:00
feat: Adds shorten_path, show_all_buffers opts and fixes alignment (buffers builtin) (#32)
This commit is contained in:
@@ -180,6 +180,8 @@ function make_entry.gen_from_quickfix(opts)
|
||||
end
|
||||
|
||||
function make_entry.gen_from_buffer(opts)
|
||||
opts = opts or {}
|
||||
|
||||
local get_position = function(entry)
|
||||
local tabpage_wins = vim.api.nvim_tabpage_list_wins(0)
|
||||
for k, v in ipairs(tabpage_wins) do
|
||||
@@ -191,6 +193,18 @@ function make_entry.gen_from_buffer(opts)
|
||||
return {}
|
||||
end
|
||||
|
||||
local make_display = function(entry)
|
||||
local display_bufname
|
||||
if opts.shorten_path then
|
||||
display_bufname = utils.path_shorten(entry.filename)
|
||||
else
|
||||
display_bufname = entry.filename
|
||||
end
|
||||
|
||||
return string.format("%" .. opts.bufnr_width .. "d : %s",
|
||||
entry.bufnr, display_bufname)
|
||||
end
|
||||
|
||||
return function(entry)
|
||||
local bufnr_str = tostring(entry)
|
||||
local bufname = vim.api.nvim_buf_get_name(entry)
|
||||
@@ -206,7 +220,7 @@ function make_entry.gen_from_buffer(opts)
|
||||
|
||||
value = bufname,
|
||||
ordinal = bufnr_str .. " : " .. bufname,
|
||||
display = bufnr_str .. " : " .. bufname,
|
||||
display = make_display,
|
||||
|
||||
bufnr = entry,
|
||||
filename = bufname,
|
||||
|
||||
Reference in New Issue
Block a user