Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ See [default configuration](https://github.com/nvim-telescope/telescope.nvim#tel

- `open_buffer_indicators` (default: `{previous = "•", others = "∘"}`)

Indicators shown to the left of results for open buffers. Set to `false` to disable completely (removes the indicator column entirely).

- `result_limit` (default: `40`)

Limit the number of results returned. Note that this is kept intentionally low by default for performance. The main goal of this plugin is to be able to jump to the file you want with very few keystrokes. Smart open should put relevant results at your fingertips without having to waste time typing too much or scanning through a long list of results. If you need to scan regardless, go ahead and increase this limit. However, if better search results would make that unnecessary and there's a chance that smart open could provide them, please [file a bug](https://github.com/danielfalk/smart-open.nvim/issues/new) to help make it better.
Expand Down
2 changes: 1 addition & 1 deletion lua/smart-open/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ return {
set_config("ignore_patterns", ext_config.ignore_patterns)
set_config("match_algorithm", ext_config.match_algorithm)
set_config("cwd_only", ext_config.cwd_only)
set_config("open_buffer_indicators", ext_config.open_buffer_indicators or ext_config.buffer_indicators)
set_config("open_buffer_indicators", ext_config.open_buffer_indicators)
set_config("mappings", ext_config.mappings)
set_config("result_limit", ext_config.result_limit)

Expand Down
20 changes: 16 additions & 4 deletions lua/telescope/_extensions/smart_open/display/make_display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ local function interp(s, tab)
end

local function open_buffer_indicators(entry, buffer_indicators)
if buffer_indicators == false then
return nil
end

local prefix = " "

if entry.buf and vim.api.nvim_buf_is_valid(entry.buf) then
Expand Down Expand Up @@ -45,6 +49,13 @@ end

local function make_display(opts)
local results_width = nil
local buffer_indicators_opt

if opts.open_buffer_indicators ~= nil then
buffer_indicators_opt = opts.open_buffer_indicators
else
buffer_indicators_opt = opts.config.open_buffer_indicators
end

local filename_opts = {
cwd = opts.cwd,
Expand Down Expand Up @@ -123,10 +134,11 @@ local function make_display(opts)
table.insert(to_display, { score_display(entry) .. " " })
end

table.insert(
to_display,
open_buffer_indicators(entry, opts.open_buffer_indicators or opts.config.open_buffer_indicators)
)
local buffer_indicators = open_buffer_indicators(entry, buffer_indicators_opt)

if buffer_indicators then
table.insert(to_display, buffer_indicators)
end

if has_devicons and not opts.disable_devicons then
local icon, hl_group = devicons.get_icon(entry.virtual_name, string.match(entry.path, "%a+$"), { default = true })
Expand Down