When using buffers picker with sort_lastused option enabled, entry at index 2 stays selected until only one entry left, even though there's better match at index 1. With additional option 'ignore_current_buffer` enabled selection works as expected.
telescope: require("telescope.health").check()
Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.
Checking external dependencies ~
- OK rg: found ripgrep 14.1.0
- OK fd: found fd 10.1.0
===== Installed extensions ===== ~
Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured
Steps to reproduce
nvim -nu minimal.lua
open some buffers
run Telescope buffers sort_lastused=true
start typing
Expected behavior
After start typing in buffers picker with sort_lastused option enabled, selection goes to entry at index 1.
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
vim.fn.system {
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
lazypath,
}
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
-- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
require("telescope").setup {}
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
Description
When using
buffers
picker withsort_lastused
option enabled, entry at index 2 stays selected until only one entry left, even though there's better match at index 1. With additional option 'ignore_current_buffer` enabled selection works as expected.Neovim version
Operating system and version
arch linux
Telescope version / branch / rev
master branch commit 5972437
checkhealth telescope
Steps to reproduce
nvim -nu minimal.lua
Telescope buffers sort_lastused=true
Expected behavior
After start typing in
buffers
picker withsort_lastused
option enabled, selection goes to entry at index 1.Actual behavior
https://github.com/user-attachments/assets/675b79b5-dc3f-4c24-bdce-db10dde68364
With
ignore_current_buffer
enabled:https://github.com/user-attachments/assets/6f4569ee-abd5-40cf-8cee-6d1610cd63c6
Minimal config