diff --git a/README.md b/README.md index 622e370..1479f41 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lua/smart-open/init.lua b/lua/smart-open/init.lua index 145f684..cb47742 100644 --- a/lua/smart-open/init.lua +++ b/lua/smart-open/init.lua @@ -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) diff --git a/lua/telescope/_extensions/smart_open/display/make_display.lua b/lua/telescope/_extensions/smart_open/display/make_display.lua index ad4eac9..825ffea 100644 --- a/lua/telescope/_extensions/smart_open/display/make_display.lua +++ b/lua/telescope/_extensions/smart_open/display/make_display.lua @@ -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 @@ -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, @@ -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 })