Skip to content

Commit cd11147

Browse files
author
Mo-TMD
committed
Add disable_coordinates option to builtin.buffers
Add disable_coordinates option to builtin.buffers to skip showing line number
1 parent a4ed825 commit cd11147

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

doc/telescope.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,8 @@ builtin.buffers({opts}) *telescope.builtin.buffers()*
14751475
specified)
14761476
{select_current} (boolean) select current buffer (default:
14771477
false)
1478+
{disable_coordinates} (boolean) don't show line number (default:
1479+
false)
14781480

14791481

14801482
builtin.colorscheme({opts}) *telescope.builtin.colorscheme()*

lua/telescope/builtin/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ builtin.reloader = require_on_exported_call("telescope.builtin.__internal").relo
355355
---@field file_encoding string: file encoding for the previewer
356356
---@field sort_buffers function: sort fn(bufnr_a, bufnr_b). true if bufnr_a should go first. Runs after sorting by most recent (if specified)
357357
---@field select_current boolean: select current buffer (default: false)
358+
---@field disable_coordinates boolean: don't show line number (default: false)
358359
builtin.buffers = require_on_exported_call("telescope.builtin.__internal").buffers
359360

360361
--- Lists available colorschemes and applies them on `<cr>`

lua/telescope/make_entry.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,14 +608,17 @@ function make_entry.gen_from_buffer(opts)
608608
-- bufnr_width + modes + icon + 3 spaces + : + lnum
609609
opts.__prefix = opts.bufnr_width + 4 + icon_width + 3 + 1 + #tostring(entry.lnum)
610610
local display_bufname, path_style = utils.transform_path(opts, entry.filename)
611+
if not opts.disable_coordinates then
612+
display_bufname = display_bufname .. ":" .. entry.lnum
613+
end
611614
local icon, hl_group = utils.get_devicons(entry.filename, disable_devicons)
612615

613616
return displayer {
614617
{ entry.bufnr, "TelescopeResultsNumber" },
615618
{ entry.indicator, "TelescopeResultsComment" },
616619
{ icon, hl_group },
617620
{
618-
display_bufname .. ":" .. entry.lnum,
621+
display_bufname,
619622
function()
620623
return path_style
621624
end,

0 commit comments

Comments
 (0)